Problem: I want to list n the number of games from each genre (order is not important)
The following MySQL query is inside the ColdFusion function. It is intended to list all games under the platform (for example, a list of all games for the PS3, a list of all Xbox 360 games, etc.). The variable for PlatformID is passed through the URL. I have 9 genres, and I would like to list 10 games from each genre.
SELECT
games.GameID AS GameID,
games.GameReleaseDate AS rDate,
titles.TitleName AS tName,
titles.TitleShortDescription AS sDesc,
genres.GenreName AS gName,
platforms.PlatformID,
platforms.PlatformName AS pName,
platforms.PlatformAbbreviation AS pAbbr
FROM
(((games join titles on((games.TitleID = titles.TitleID))) join genres on((genres.GenreID = games.GenreID))) join platforms on((platforms.PlatformID = games.PlatformID)))
WHERE
(games.PlatformID = '#ARGUMENTS.PlatformID#')
ORDER BY
GenreName ASC,
GameReleaseDate DESC
As soon as the query results return, I group them in ColdFusion as follows:
<cfoutput query="ListGames" group="gName"> (first loop which lists genres)
<cfoutput> (nested loop which lists games)
</cfoutput>
</cfoutput>
, 10 . "" 50 SQL, ~ 50 ( , ). , , .
?
!