Forum Moderators: open

Message Too Old, No Replies

MySQL sorting issue

Sorting by different criteria

         

skyblue webteam

10:14 pm on Sep 24, 2007 (gmt 0)

10+ Year Member



I have the problem with sorting rows by different criteria. I have games table and among others, there are rate and category columns. What i want is to select 4 most popular games from all categories, i mean 4 most popular action games, 4 strategies etc. I hope i described my problem well. SQL experts, help me please! :)

Thanks in advance,
Milan

phranque

10:53 pm on Sep 24, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



let me be first to welcome a long time lurker to WebmasterWorld, milan!

are you trying to do this in one query?
i believe it would take one query to get the categories and then N queries to get the top rated 4 in each category.

skyblue webteam

11:03 pm on Sep 24, 2007 (gmt 0)

10+ Year Member



Thanks. It's great to be here. ;)

Yeah, i know i could do this with N queries, but i'm trying (if that is possible at all) to join them into on, so i could save server resources.