pinkiguana 0 Newbie Poster

I have a list of questions, each has its own category. I want to be able to select 5 random questions from each category and then display them ordered by category in something like a nested repeat region. I have the sql for obtaining the random 5 for each category but I would like to pass this category as long as there is a category to get this dataset all at once, rather than one page for each category as I have right now. Basically:
For each B]CATEGORY VALUE[/B] in select B]CATEGORY VALUE[/B] from TA_BusMetricsDef

SELECT TOP (5) dbo.TA_Questions.TA_QId, dbo.TA_Questions.TA_Question, dbo.TA_BusMetricsDef.TA_BusMetricDescript, dbo.TA_Questions.TA_BusMetricName
FROM dbo.TA_Questions INNER JOIN dbo.TA_BusMetricsDef ON dbo.TA_Questions.TA_BusMetricName = dbo.TA_BusMetricsDef.B]CATEGORY VALUE[/B]
WHERE dbo.TA_Questions.TA_BusMetricName = dbo.TA_BusMetricsDef.CATEGORY VALUE(PASSED BY THE FOR LOOP)

Can someone help me structure this appropriately using the right syntax so I can get results? Thanks!