Results 1 to 2 of 2

Thread: Distinct Query

  1. #1
    Join Date
    Aug 2003
    Posts
    18

    Unanswered: 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

    BaRRon

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    This sounds familiar

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •