Ranking by Group
Posted on 2011-03-18
I have a simple table, ER, with the fields ID, Date and ExpRet. I want to get ranks for every date based on ExpRet. In other words, on 4/30/2011, I want to know the top ExpRet for that day and do that for every day.
Based on some internet research, I thought I could do the following:
Rank: (SELECT ER.Date, (SELECT Count(*) FROM ER AS T WHERE T.Date = ER.Date AND T.ID <= ER.ID ORDER BY T.ID) AS ExpRet;)
However, I'm getting a syntax error and can't figure out what I'm doing wrong.
Thanks for any help!