I have the following query:
Select Player_Id,
Pt_Credit As Total_Points
From Player
Where Trunc(Create_Dtime) = Trunc(Sysdate) - 90
And Trunc(Init_Dtime) >= To_Date('2012-sep-1','yyyy-mon-dd')
Order by Total_Points Desc
Which gives me this result:
Player_ID TOTAL_POINTS
23452 1500
23494 1000
30934 500
and so on. I want to group these player_ids results into groups like 0-300 points, 301-600 points, 601-900 points , and greater than 900 points…so it would look like this in the results:
Point_Level Count(Player_ID)
0-300 532
301-600 444
601-900 669
>900 185
Use
CASE ... WHENOr in your example: