Replace the distinct method to find duplicate records

Source: Internet
Author: User
Repeat | duplicate record

Usually choose duplicate records, all need to use distinct, but there is a bad place, that is, can not select multiple fields, Internet search for a long, in the dynamic network found a paste to solve this problem, the use of the following statement:

Sql= "Select a,b from tab where ID to (select min (id) from tab Group by a)"

  About SQL distinct to prevent the confusion of recording repeated statements

It used to be very rare, but now there is a project that requires that the record not be duplicated

Rs.Open "Select Distinct Member from table 1 where theme =false and experience >200 ORDER by member Desc", link1,1,1

The above SQL statements can be taken out of the database eligible members (and can be implemented without back duplicate records), but if changed to the following three cases, there will be no record or call out records have duplicates or call out of the record anomaly, excuse me, this is why? does distinct specify a field to filter one at a time?

Rs.Open "SELECT Distinct * from table 1 where topic =false and experience >200 ORDER by member Desc", link1,1,1
Rs.Open "Select DISTINCT member, registration date from table 1 where theme =false and experience >200 order by member, registration date desc", link1,1,1
Rs.Open "Select DISTINCT member, registration date from table 1 where theme =false and experience >200 ORDER by member Desc", link1,1,1



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.