1:SELECT * FROM T_STANDARD_SYSTEM GROUP BY SYSTEM_ID ORDER BY SYSTEM_ID
2:SELECT *,COUNT(DISTINCT system_id) FROM T_STANDARD_SYSTEM GROUP BY SYSTEM_ID ORDER BY SYSTEM_IDselect * FROM T_STANDARD_SYSTEM WHERE system_Id IN(SELECT MAX(system_id) FROM T_STANDARD_SYSTEM GROUP BY system_id)
上面第二条是解决mysql不同版本不兼容问题,第一条在某些版本中是能用的。但是不规范在sqlserver中两条都不能用。
SELECT SYSTEM_ID,
MAX(SYSTEM_ABRIDGE) SYSTEM_ABRIDGE,
MAX(SUB_SYSTEM_ID) SUB_SYSTEM_ID,
MAX(SUB_SYSTEM_NAME) SUB_SYSTEM_NAME,
MAX(CUSTOM_SYSTEM_ID) CUSTOM_SYSTEM_ID,
MAX(CUSTOM_SYSTEM_NAME) CUSTOM_SYSTEM_NAME FROM T_STANDARD_SYSTEM GROUP BY SYSTEM_ID ORDER BY SYSTEM_ID
以上这条是解决sqlserver和mysql上面那个不兼容问题的。
Oracle提供一个rowId可以通过子查询方便的解决上述去重问题