1: select count(distinct y) from x2:select top 1 age from t where age not in(select max(age) from t) order by age desc
top 1 是什么意思 select top 1 age from t where age not in(select max(age) from t) order by age desc 查询年龄按降序排列 查询的不是最大的年龄 查到的是第2个数据 是这个意思吗 TOP 1指的就是第2个数据 是这个意思吗?
top1,是选择库中的第一条记录 select top 1 age from t where age not in(select max(age) from t) order by age desc 上面语句的意思就是选择年龄不包含第一大年龄的记录,然后排序,然后再从其中选择第一条记录,也就是第二大年龄的记录
select count(distinct y) from x2:select top 1 age from t
where age not in(select max(age) from t)
order by age desc
select top 1 age from t
where age not in(select max(age) from t)
order by age desc
查询年龄按降序排列 查询的不是最大的年龄 查到的是第2个数据 是这个意思吗 TOP 1指的就是第2个数据 是这个意思吗?
select top 1 age from t
where age not in(select max(age) from t)
order by age desc
上面语句的意思就是选择年龄不包含第一大年龄的记录,然后排序,然后再从其中选择第一条记录,也就是第二大年龄的记录