求一条SQL语句的写法,关于max的 我有这样两个字段nd number2002 5002001 8002003 400我想找到max(nd)所对应的number数字这条SQL语句怎么写呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select number from tablenamewhere nd = (select max(nd) from tablename) 或select top 1 number from tablename order by nd desc nd 字段是否有重复的select * from tablename where nd=max(nd) 忘了说了,我前面还有一个字段是学好学号 nd number01 2002 50001 2001 80001 2003 400统计的是一个学好的 max(nd)的 number值?不好意思 select 学号,number from tablenamewhere nd = (select max(nd) from tablename)就是啦,还有什么吗? 那就要这样select a.number from tablename ainner join (select 学号,max(nd) as nd from tablename group by 学号) b on a.学号=b.学号 and a.nd = b.nd select distinct 学号,number from table1 a inner join(select 学号,max(nd) as maxValue from table1 group by 学号) as bon a.学号=b.学号 and a.nd=b.nd LogExplorer无法注册 数据库聚合函数的一个小问题 sql 查询使用 in() 类型转换疑问 简单问题。 求一条SQL语句(批量更新数据) 求教:我有个表有入库时间,有出库时间,我想得到该样式号每月的销售和历史库存 取身份证 数据库原理考试,大虾帮忙 要找出一个表的最后一条记录,用sql语句怎么做?急!在线等待 SQL 多条件查询并去除重复 这应该怎么改? 求助:SQL检测时间段冲突问题?
where nd = (select max(nd) from tablename)
select top 1 number from tablename order by nd desc
学号 nd number
01 2002 500
01 2001 800
01 2003 400
统计的是一个学好的 max(nd)的 number值?
不好意思
where nd = (select max(nd) from tablename)就是啦,还有什么吗?
inner join (select 学号,max(nd) as nd from tablename group by 学号) b on a.学号=b.学号 and a.nd = b.nd
(select 学号,max(nd) as maxValue from table1 group by 学号) as b
on a.学号=b.学号 and a.nd=b.nd