oracle查询所有大于女生最大年龄的男生信息,sql怎么做啊,求大神,oracle查询所有大于女生最大年龄的男生信息
select * from table where age > (select max(age) from table where sex ='女' ) and sex = '男'
select 男生信息 from 表 a where a.age > (select max(女生年龄) from 表 ) and sex = '男'
子查询,先查女生中年龄最大的,然后在查男生大于女生最大年龄的人
select * from 信息表 where 性别='男' and 年龄>(select max(年龄) from 信息表 where 性别='女')
先查询女生中的最大年龄,,然后查询男生大于女生中最大年龄
select * from userinfo a where a.age >(select max(age) from a where sex='女') and a.sex='男';