Today we share two SQL statements about querying repeating fields in a table and displaying the number of repeating bars for that field.
1.select * FROM table name where column name in (select Column name from table name Group By column name have COUNT (*) >1) Order BY column name
Operation Result:
Note * Query all duplicate fields under a column in the table, and if you want to query the column for the number of repeating bars >=n, simply change the ">1" in the SQL statement to "N-1" .
2.select column Name, COUNT (*) count from table name where column name in (select Column name from table name Group By column name have COUNT (*) >1) Group By column name ORDER by C Ount ASC "
Operation Result:
Note * Query the repeating fields and quantities in a column of a table and sort them in ascending order of quantity.
3.select * FROM table name where column name in (' + field name + ') Order BY column name
Note * The table in a column under a repeating field show all (the result is to click on the "Xinzheng JuJube" entry in figure II after the name passed, as a query criteria).
SQL statement Query table repeating field and display field repeating number of bars