Sunday, March 25, 2012

Distinct Query

Hi everybody,

I would like to select all "id" in a table ONLY where "raff" is distinct.

I think it shoult be such a thing:

SELECT id FROM mytable WHERE (SELECT DISTINCT raff) or

SELECT id FROM (SELECT DISTINCT raff FROM mytable)

So what is the correct syntax

Thnak U

BaRRonThis sounds familiar

select id = max(id)
from tbl
group by raff
having count(*) = 1

No comments:

Post a Comment