I have spent the last 2 hours searching for this, and every thing I have tried has not worked. I have a table_Sessions for which I want to return a BranchID and Average cost of each session. But I only want to show the top 2 averages.
I have literally tried everything i have come across. either it doesnt fit my case, or I have appropriated it wrong. Either way, I'm going crazy here.
Here is what I have so far, and it seems to do about 80% of what I want it to (last 20% being only show the top 2 highest average costs)
SELECT BRANCHID, AVG(SESSIONPRICE)
FROM SESSIONS
GROUP BY BRANCHID
ORDER BY AVG(SESSIONPRICE) DESC;
If someone could PLEASE tell me how to append to it, I would greatly be appreciative of it. I am using Oracle SQL Developer.
Thanks
ORDER BY AVG(SESSIONPRICE) DESC, branchid asc