Results 1 to 2 of 2

Thread: SQL subselect

  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Arrow Unanswered: SQL subselect

    Hi all,

    The fields of TABLE are: city, high, and, low.

    I would like to get all pairs of cities,
    that the temp range of the first city in the
    pair fully contains the range of the second city in
    the pair.

    here is the data:

    city high low
    --------------
    NYC 60 40
    Moscow 80 20
    Tokyo 55 50

    The results will be:
    ----------------------
    Moscow NYC
    Moscow Tokyo
    NYC Tokyo

  2. #2
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    Here you go:

    Code:
    select A.Country,B.Country from 
    Test1 A join Test1 B on A.High>B.High 
    and A.Low<B.Low 
    order by A.High desc
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

Posting Permissions

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