SELECT *FROM( SELECT ROW_NUMBER()OVER(PARTITION BY m_type order by m_id) AS Num,* FROM m_data) as tempWHERE Num <= 100