Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Ottieni i primi 'n' record da report_id

Che ne dici

SELECT *
FROM (SELECT *,
         ROW_NUMBER() OVER(PARTITION BY report_id ORDER BY (SELECT 0)) AS RN
         FROM top_keywords
         WHERE ym BETWEEN '2010-05' AND '2010-05') TK
WHERE RN <= 10