...

View Full Version : MAX and min



adi5402
03-05-2006, 02:37 AM
I have a table called country which has a field called life expectancy I need to ran a query to bring up the names of countrys with both max life expectancy and min life expectancy in one run. I have manged to do this seperately but need help with the single query.


JUST MAX

select continent "Continent",
MAX(LifeExpectancy) "Life Expectancy"
from country
Group by continent asc limit 0,1;

JUST MIN

select continent "Continent",
MIN(LifeExpectancy) "Life Expectancy"
from country
Group by continent desc limit 0,1;

any help will be great

GJay
03-06-2006, 08:14 AM
put UNION in the middle of the queries and use that



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum