Friday, 15 February 2013

Simple SQL query for Min and Max -



Simple SQL query for Min and Max -

so trying find age of oldest , youngest male , female patients along average age of male , female patients in clinic work. new sql comes 1 table believe named "patients". within patients table there column gender has either m male or f female. there age column. guessing simple , making complicated seek help me out?

my query pretty limited. know if along lines of:

select min(age) agemin, max(age) agemax patients

use group by clause:

select * @mytable m 10 m 15 m 20 f 30 f 35

f 40

select gender, min(age), max(age), avg(age) @mytable grouping gender

f 30 40 35

m 10 20 15

sql

No comments:

Post a Comment