Deduplication of database query data

Project scene:

Today I encountered a scenario where the user’s name and mobile phone number need to be recorded when querying and sending text messages, but there are a lot of duplicate data in the database table


Problem Description:

At first I wanted to use distinct, but found that the distinct function can only contain one parameter

solution:

Deduplicate data is achieved by grouping

select user_name,phone from users group by user_name,phone; 

Guess you like

Origin blog.csdn.net/qq_44688861/article/details/114254975