Today due to the work needs, need to find a field in the database a different record value, very simple question is I think too complex, is very depressed, the reason is a command of SQL forgot, now the problem has been solved, quickly take to do the memo.
In fact here only need to use the DISTINCT command in SQL, very simple, the syntax is as follows:
Copy Code code as follows:
SELECT DISTINCT column name from table name
An example is provided:
Suppose you have an existing database table: Htmer:
Copy Code code as follows:
field001
Record 1
Record 2
Record 1
Record 3
Now there are four records in this table, but one record is duplicate, if I want to remove the duplicate record, only the SQL statement that lists the duplicates is:
Copy Code code as follows:
SELECT DISTINCT field001 from Htmer
The results are as follows:
Copy Code code as follows:
field001
Record 1
Record 2
Record 3