Minimum and maximum prices

Discussion in 'Databases' started by Python, Sep 6, 2008.

  1. #1
    I have two tables... 'product' and 'product_prices'.

    The 'product' table simply holds basic information about various products and the 'product_prices' holds a number of prices for each product which have been extracted from various retailers.

    I want to find out the lowest and highest price for a particular product and preferably do it in just the one query.

    I have this...

    SELECT
    	MAX(price) AS PRICEhigh,
    	MIN(price) AS PRICElow
    FROM
    	product_price
    WHERE
    	product_price.productID = " . $aProduct[ID] . "
    
    Code (markup):
    After using print_r() in PHP all it seems to do is return the two highest prices.

    If you have any ideas on how to fix, it would help greatly :D

    Thanks
     
    Python, Sep 6, 2008 IP
  2. Python

    Python Well-Known Member

    Messages:
    680
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Problem solved - had the wrong data type in my table
     
    Python, Sep 6, 2008 IP