'Mode' row aggregate function in SQL7

Status
Not open for further replies.

oldshaghat

Ars Tribunus Militum
2,449
I'm stumped. Does anyone know a way to extract the mode of a group by set? That is to say, the entry that appears most often?

example:

tblA:
grpID favFruit
1 Apple
1 Apple
1 Banana
1 Apple
2 Banana
2 Apple
2 Banana

select mode(tblA.favFruit) from tblA group by tblA.grpID

grpID
1 Apple
2 Banana

Is it about time that I learned about stored procs?
 
Status
Not open for further replies.