I am using below SQL query to count the records. I would like to discount the duplicate testID after I got the count.
example:
select COUNT(*) from PRODUCT where CLASS_TYPE = 'test'
above query give 5 records
testID 1234-00-01 1234-00-01 1234-00-02 1234-00-02 1111222233
I want to get the count = 5 – duplicate 2 = 3
Is there SQL query I can use to find out the duplicate records, then calculate the final count?
Advertisement
Answer
Please use below query,
select COUNT(distinct testID) from PRODUCT where CLASS_TYPE = 'test'