knrt.net
当前位置:首页 >> sql 最小值 记录 >>

sql 最小值 记录

SELECT * FROM TABLE WHERE 时间= (SELECT min(时间)FROM TABLE)这样应该就可以了!

select year month from 表格名 where month=(select Min(month) from 表格名 where year=(select Min(year) from 表格名))

SELECT * FROM 表 WHERE (字段 IN (SELECT MIN(字段) FROM 表))

$RS.Open ("Select account ,pwd,Sname,area,rolename From Account where (use=0) ORDER BY level limit 1 ")

ORACLE 可以直接函数取 greatest(repdate,repcreatedate,RepAuditTime,printime) mssqlserver可能先列转行求分组最大,没有测试环境,忘记了

delete from 表A as a where a.编号 in (select min(b.编号) from 表A as b where a.编号= b.编号)

我有一个表,其中有日期,时间字段,我要找出满足条件的记录,但是日期必须是最小的。date:日期字段time:时间字段.....怎么写sql语句?不知为何只能给31分,不够以后再加 查看更多答案>>

这样 select id,riqi,min(shijian) as shijian from kq group by id, riqi union select id,riqi,max(shijian) from kq group by id, riqi

select userID from user a left outer join(select min(checkper) as checkper,role_id,dept_id from role group by dept_id,role_id) b on a.role_id=b.rold_id and a.dept_id=b.deptid

都最小? 你能保证id最小的记录里成绩也是最小的嘛? 如果是的话 select * from table order by id asc,grade asc limit 1就可以了。 如果不是的话,你不能只找到1条记录的,至少也是2条吧?

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com