Query the same field values in a column of the table.
Example: query the user_id values in the user_id column of sms_user_organ.
Table Name: sms_user_organ
User_id organ_id
4427 549
4428 7
4428 9
4429 394
Query statement
Select * From sms_user_organ
Where (select count (*) from sms_user_organ where user_id = A. user_id)> 1
Query Result
User_id organ_id
4428 7
4428 9
Or write a query statement.
Select a. user_id from sms_user_organ a group by A. user_id having count (*)> 1
Result
User_id
4428
4428 after modification:
Select * from test
Where (select count (*) from test where number = A. Number) = 1
The preceding SQL statement can be used to identify all elements in the database (including all rows and columns)
The sum of the number of all rows in the select count (*) from test statistical table
Select a. Number from test a group by A. number having count (*)> 1. Check the repeated elements in the number column.
Select a. Number from test a group by A. number having count (*) = 1 find all non-repeating elements in the Number Column
Select a. Number from test a group by A. Number: Check that all elements in the number column are repeated once.
Select number from test to find all the elements whose column name is number in the test table.