sql - mysql result using query -
i've got table in mysql 2 two fields (age, sex) need avg(age) sex (m or f), can me solve ? how should 1 query getting both of looks like?
try this:
select avg(case when sex = 'm' age end) avg_male , avg(case when sex = 'f' age end) avg_female , name, book_date reviews r inner join books b on b.id = r.book_id age<30 <-------------- group book_id <-------- can group here column like.
Comments
Post a Comment