合并SQL语句

ws010 2008-07-10 04:52:30
 select fvolume,fcode, fname from tb_secpossession where fsetid = 'SB0204' and ftype='GP' and fdate = to_date('2008-1-8','yyyy-mm-dd') and fvolume <> 0

结果如下:

select * from tb_secpossession where fsetid = 'SB0204' and ftype='GP' and fdate = to_date('2008-1-31','yyyy-mm-dd') and fcode ='002203'

fcode为上表中每一个fcode。
如何合并成一条语句?
...全文
80 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dbcxbj 2008-07-10
  • 打赏
  • 举报
回复
sorry,看走眼了
select * from tb_secpossession where fsetid = 'SB0204' and ftype='GP' and fdate = to_date('2008-1-31','yyyy-mm-dd') and fcode in (select fcode from tb_secpossession where fsetid = 'SB0204' and ftype='GP' and fdate = to_date('2008-1-8','yyyy-mm-dd') and fvolume <> 0)
ws010 2008-07-10
  • 打赏
  • 举报
回复
这逻辑明显不对嘛
dbcxbj 2008-07-10
  • 打赏
  • 举报
回复
select 你要的字段 from tb_secpossession where (fsetid = 'SB0204' and ftype='GP' and fdate = to_date('2008-1-8','yyyy-mm-dd') and fvolume <> 0) or (fsetid = 'SB0204' and ftype='GP' and fdate = to_date('2008-1-31','yyyy-mm-dd') and fcode ='002203')


17,382

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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