求一句sql,向高手求教

bluekangkang 2008-02-21 02:46:28
我现在有一个面试表,fr_code是面试记录key(主键),fr_ecode是人员记录key(另一个表的key,外键),fr_ymd是面试时间,查找表中每一个人最新的面试记录(用fr_ymd 作判断)的fr_code
...全文
105 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
youankang 2008-02-21
  • 打赏
  • 举报
回复
select fr_code from facerecord a where fr_ymd in(select max(fr_ymd) from facerecord where fr_ecode=a.fr_ecode)
pt1314917 2008-02-21
  • 打赏
  • 举报
回复

--或者:
select * from 面试表 a where fr_ymd in(select max(fr_ymd) from 面试表 where fr_ecode=a.fr_ecode)

--等等

pt1314917 2008-02-21
  • 打赏
  • 举报
回复

select * from 面试表 a where not exists(select 1 from 面试表 where fr_ecode=a.fr_ecode and fr_ymd>a.fr_ymd)

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧