Forum Moderators: open

Message Too Old, No Replies

Querying mysql rows without including duplicates?

mysql, dupes, duplicates, distinct, query

         

ShaunG

2:46 pm on Apr 3, 2009 (gmt 0)

10+ Year Member



How would I query only certain rows without including dupes when I am comparing 3 different columns? For example, there are 6 columns and I want to query for id, type, and date but since my db record dupes, I do not want to include any row that has the same type AND subid AND date.

rocknbil

3:07 pm on Apr 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Explore distinct [dev.mysql.com], this should provide a solution.

ShaunG

3:36 pm on Apr 3, 2009 (gmt 0)

10+ Year Member



I am new to sql so I'm not sure why this would not work....it is returning empty set...

SELECT DISTINCT thedate, subid, thetype
FROM tablename
WHERE thedate=2009-04-03

ShaunG

3:48 pm on Apr 3, 2009 (gmt 0)

10+ Year Member



nevermind i got it..i needed

WHERE thedate='2009-04-03'