Go Back   CodingForums.com > :: Server side development > MySQL > Other Databases

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-05-2006, 02:37 AM   PM User | #1
adi5402
New to the CF scene

 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
adi5402 is an unknown quantity at this point
MAX and min

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
adi5402 is offline   Reply With Quote
Old 03-06-2006, 08:14 AM   PM User | #2
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
put UNION in the middle of the queries and use that
GJay is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:34 PM.


Advertisement
Log in to turn off these ads.