mssql根据分类查询每个分类前100条数据 表名m_data,分类字段名m_type
SELECT *
FROM( SELECT ROW_NUMBER()OVER(PARTITION BY m_type order by m_id) AS Num,*
FROM m_data) as temp
WHERE Num <= 100
SELECT *
FROM( SELECT ROW_NUMBER()OVER(PARTITION BY m_type order by m_id) AS Num,*
FROM m_data) as temp
WHERE Num <= 100