Oracle partition by and partition... order by grouping partition by and partition... difference in order by usage. I just used it. Confused: Table t a B C 1 43 2013-4-17 2 33 2013-4-18 3 10 2013-4-17 use partition by: When rank () is used, use order by Select rank () over (partition by C order by B desc) as rank, C, B, A from t. The result is as follows: rank c B A 1 2013-4-17 43 1 2 2013-4-17 10 3 1 2013-4-18 33 2 hierarchical display of it, for the same date, the sorting method based on order by is upgraded to a certain level. If I want to query the maximum value of Column B in each day, then: select * from (Select rank () over (partition by C order by B desc) as rank, C, B, A from t) table where table. rank = 1. In this way, the highest record rank c B A 1 2013-4-17 43 1 1 2013-4-18 33 2 is used now sum () or count () these functions are used for example: to query the sum of Column B of each day, select sum (B) over (partition by C order by c asc) as sum, C, B, A from t if order by is added here, the data above this time is accumulated, then sum c B a 1 2013-4-17 43 1 53 2013-4-17 10 3 33 2013-4-18 33 2 if order by is not added, that is: select sum (B) over (partition by C) as sum, C, B from t will not accumulate the previous data, as long as the last data is displayed, but multiple; sum c B a 53 2013-4-17 43 1 53 2013-4-17 10 3 33 2013-4-18 33 2 this way, if you calculate the sum of every day, that is, select sum, C from (select sum (B) over (partition by C) as sum, C, B from t) tt group by sum, B, C, then sum C 53 33