Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

group by clause get the last row of max occurence

matMay 29 2013 — edited May 29 2013
Table 1

Division Incident
1 xyz
2 abc
3 efg
1 klo
2 jkl

I want to have an sql query which groups the occurrences of (division) in the table. If two grouping counts are same, it should give largest division.. division 1 and 2 have 2 occurrences each.

select div, count(*) FROM TABLE1 GROUP by division is not giving the result.

I am trying to get division 2 as the answer. No other rows should be present in the return
This post has been answered by Tubby on May 29 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2013
Added on May 29 2013
5 comments
2,614 views