一个select的初级问题,谢谢

birdnotcold 2006-01-21 11:53:42
一个select语句 select......from.....where....

要在其select列表中加一个带子查询的select语句 例如select a, b, c, (select w, y from...where w in (select...from...where...)) from....where....

如果in后面括号里面select...from...where...结果集 就是 最外面select语句的结果集(就是select a, b from....where....),

请教如何能直接借用最外面的结果集作为in()内的查询范围,而不用像我上面写的重新检索???

谢谢
...全文
71 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
$扫地僧$ 2006-01-23
  • 打赏
  • 举报
回复
你是这个意思吗!?
select A.id,A.a,A.b,A.c,(select D from B where id=A.id)
from table A
samson_www 2006-01-23
  • 打赏
  • 举报
回复
没明白你的意思

34,590

社区成员

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

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