岁月如灬风 2019-12-25 11:06 采纳率: 0%
浏览 190

oracle SQL语句问题,大神们留步,帮忙看一下。

查询语句

with res as
 (select t.id,
         (select codename from tb_tpost_code where id = r.mpostid) mpostname,
         (select codename from tb_tpost_code where id = r.spostid) spostname,
         (select p.unitname from PXGL_UNIT p where p.unitid = t.unitid) unitname,
         t.username,
         to_char(t.maintime, 'yyyy') maintime,
         t.scoredate,
         t.score srscore,
         t.idcard,
         t.flowsta,
         r.reachscore,
         s.itemname,
         s.score perscore,
         t.yitemid,
         t.noexamsign,
         t.estatime
    from TB_TPOST_SKILLRESULT  t,
         TB_TPOST_SKILLITEM    s,
         TB_TPOST_SKILLSTANDAR r
   where s.standarid = r.id
     and t.yitemid = s.id
     and s.flowsta = 99
     and t.unitid = 163701
     and ((t.noexamsign = 1 and to_char(t.estatime, 'yyyy') = 2019) or
         to_char(scoredate, 'yyyy') = 2019)
     and r.mpostid = 39
     and r.capgrade = 1)

现要在现代码加上筛选:
条件:1.如果b.yitemid(项目ID)相同,t.idcard(同一个人)相同情况下,
t.noexamsign的值为1并且t.flowsta为99, t.estatime时间最新的显示
2.t.noexamsign不为1,t.estatime时间最新的显示
这个怎么写,有大佬帮忙看一下吗。。。

  • 写回答

1条回答 默认 最新

  • 技术SOLO网 2023-06-09 11:26
    关注

    没看清楚你的问题,不过如果是不同的条件的话,你可以分两次查询

    评论

报告相同问题?

悬赏问题

  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示