New help with SQL Server select statement

Posted by gio_333m on Stack Overflow See other posts from Stack Overflow or by gio_333m
Published on 2010-06-05T21:10:20Z Indexed on 2010/06/05 21:42 UTC
Read the original article Hit count: 131

Filed under:
|
|

I need help with select statement in SQL Server / T-SQL

My table looks like this:

Id (int)  
QuestionId (int)  
GenreId (int)  

I want to select random N rows from this table so that maximum number of same GenreId in the result set is less than X for all GenreId-s except one. For that one GenreId, I need row count with that GenreId to be equal to Y.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server