SQL statement to remove duplicate records and obtain duplicate records
--QueryEffectively remove duplicate records in a table, UserID is an auto-increasing primary key, and RoleID is a repeated field
SELECT MIN(UserID) AS UserID, RoleID FROM tmpTable GROUP BY RoleID SELECT RoleID FROM tmpTable GROUP BY RoleID HAVING (COUNT(*) > 1) SELECT DISTINCT * FROM tmpTable
sql statement query all table names and field names in the sql server access database February 01, 2007 Thursday 04:21 PMSQL SERVER
View all table names:
select name from sysobjects where type='U'
Query table All field names:
Select name from syscolumns Where ID=OBJECT_ID('表名') select * from information_schema.tables select * from information_schema.views select * from information_schema.columns
ACCESS
View all table names:
select name from MSysObjects where type=1 and flags=0
MSysObjects are system objects, which are hidden by default . It can be displayed through tools, options, view, display, and system objects
The above is the detailed content of SQL statement to remove duplicate records and obtain duplicate record example code. For more information, please follow other related articles on the PHP Chinese website!