SQL: Data is deduplicated by multiple columns

1. Use group by to group by multiple columns

  • You can also use the group_concat() function to take out the data that does not need to be re-listed.
select group_concat(interfaceid), ip, port from interface group by ip, port;

2. Use distinct to deduplicate by multiple columns

  • distinct can deduplicate multiple columns. Data that does not need to be rearranged cannot be taken out, and distinct must be placed at the top.
select distinct ip, port from interface;

Guess you like

Origin blog.csdn.net/name_sakura/article/details/130889925