group by clause get the last row of max occurence
matMay 29 2013 — edited May 29 2013Table 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