子查询返回的值不止一个.如何解决呢?在线等待啊。。急!!!

kissapple500 2010-08-12 11:50:06
select * from JCXX_OtherItemRecord where employeeID=(select id from RSGL_Employee)

我要查找JCXX_OtherItemRecord表中的employeeID只要等于(select id from RSGL_Employee) 这个结果集里的ID的所有集合。JCXX_OtherItemRecord表中employeeID跟RSGL_Employee表的ID关联。

该怎么写呢???请大哥们帮帮忙啊。。。试了好多方法了呀。。。
...全文
67 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
feilniu 2010-08-12
  • 打赏
  • 举报
回复
select * from JCXX_OtherItemRecord where employeeID=any(select id from RSGL_Employee)

这样也行。不过没有IN常用。
kissapple500 2010-08-12
  • 打赏
  • 举报
回复
啊。谢谢大家了。。原来就是IN啊。。哈哈。。
hao1hao2hao3 2010-08-12
  • 打赏
  • 举报
回复
或者



select * from JCXX_OtherItemRecord as a join RSGL_Employee as b on a.employeeid = b.id where ....

feixiaocaohen 2010-08-12
  • 打赏
  • 举报
回复
select * from JCXX_OtherItemRecord where employeeID in (select id from RSGL_Employee)
情殇无限 2010-08-12
  • 打赏
  • 举报
回复
select * from JCXX_OtherItemRecord where employeeID in (select id from RSGL_Employee)  
hao1hao2hao3 2010-08-12
  • 打赏
  • 举报
回复

select * from JCXX_OtherItemRecord where employeeID in (select id from RSGL_Employee)

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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