Wednesday, March 28, 2012

help on sql select

i got a table as following
product_id product_name product_description product_price

there are about 50 rows in this table, my qeustion is how to write an SQL statement that return product_name, description and price( or every colume) for the the lowest product_price in this table.
i know this sql will return the lowest price(select min(product_price) from product), but it doesn't return other information about it.

i also try the following statement, but didn't work
select * from product where min(product_price)

what is the sql statement to perform this requirement?

Hi,

very simple one is just to write

select * from product where product_price = (

select min(product_price) FROM product

)

Or even simpler

select top 1 * from product order by product_price ASC

|||problem solved, that's simple.
thanx

No comments:

Post a Comment