Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Posts
    12

    Unanswered: Top result query

    Dears,

    I have a data of the following form:

    ItemID---------SiteID
    11-------------34
    11-------------19
    11-------------25
    12-------------76
    12-------------83
    12-------------9
    11-------------65
    13-------------44

    I want a query which returns ItemID with a single first SiteID of it:

    11-------------34
    12-------------76
    13-------------44

    I think this is simple, but I couldn't solve

    Any help?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    unfortunately, the concept of "first" has no meaning in relational databases, where the rows are not in any particular sequence

    you can have MIN or MAX, but not FIRST
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Aug 2005
    Posts
    12
    Nice if I can have the MAX, how to do so?

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    See Max().

    -PatP

Posting Permissions

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