Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   finding maximum and minimum in a column (http://www.go4expert.com/forums/finding-maximum-minimum-column-t10287/)

nmh 29Apr2008 12:58

finding maximum and minimum in a column
 
In a table called Item there are several items. Item with same can be there such as chocolate, toffee but they have a different Item code. How can I find the Same item with maximum and minimum values.?(That is chocolate with with maximum and minimum prize).

I thank you in advanced.

shabbir 29Apr2008 17:12

Re: finding maximum and minimum in a column
 
Here they come

Code:

Select * from chocolate where price = (Select max(price) from chocolate)
Code:

Select * from chocolate where price = (Select min(price) from chocolate)

nmh 29Apr2008 19:17

Re: finding maximum and minimum in a column
 
shabbir
Thanks a lot
cheers


All times are GMT +5.5. The time now is 01:03.