De-duplication that cannot be solved by distinct in sqlserver maxgroupby bitsCN.com
De-duplication cannot be solved by distinct in sqlserver max groupby
1: SELECT * FROM T_STANDARD_SYSTEM group by SYSTEM_ID order by SYSTEM_ID2: 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)
The second article above solves the incompatibility problem between different mysql versions. The first article can be used in some versions. But neither of them can be used in sqlserver.
SELECT SYSTEM_ID, MAX (SYSTEM_NAME) SYSTEM_NAME, 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
The above article solves the incompatibility problem between sqlserver and mysql.
Oracle provides a rowId to easily solve the preceding deduplication problem through subqueries.
BitsCN.com