select 学号,姓名,年龄 from 表 where (年龄 in (select max(年龄) from 表 where 性别 = '男') or (年龄 in (select min(年龄) from 表 where 性别 = '女')为什么要用存储过程那?
--修改一下 select 学号,姓名,年龄 from 表 where (年龄 in (select max(年龄) from 表 where 性别 = '男') and 性别 = '男') or (年龄 in (select min(年龄) from 表 where 性别 = '女') and 性别 = '女')
create proc test as select name,age,xb from tb where age in (select max(age) as age from tb group by xb)--exec test 执行
where (年龄 in (select max(年龄) from 表 where 性别 = '男')
or (年龄 in (select min(年龄) from 表 where 性别 = '女')为什么要用存储过程那?
select 学号,姓名,年龄 from 表
where (年龄 in (select max(年龄) from 表 where 性别 = '男') and 性别 = '男')
or (年龄 in (select min(年龄) from 表 where 性别 = '女') and 性别 = '女')
as
select name,age,xb from tb where age in (select max(age) as age from tb group by xb)--exec test 执行