SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    WebAmoeba mythix's Avatar
    Join Date
    Aug 2002
    Location
    here
    Posts
    578
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple query question

    Ok I have a table called SaleProperty which includes house prices

    Now I want to output the property with the highest value and the lowest value so i came up with:

    SELECT *
    FROM SaleProperty
    WHERE price = (SELECT MIN(price) FROM SaleProperty)
    OR
    price = (SELECT MAX(price) FROM SaleProperty);

    Is there a better way of doing this? i.e. with one sub query instead of two?

    Thanks.

    Note: this is in MS Access XP 2002
    Laws are like sausages. You have much more respect for them if you haven't actually seen how they're made.

    http://www.webamoeba.co.uk

  2. #2
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about:

    select min(price) as MinPrice, max(price) as MaxPrice
    from SaleProperty

    Mike


Bookmarks

Posting Permissions

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