作者bohei (run and fall)
看板Database
标题Re: [SQL ] left join(?)
时间Tue Jun 24 18:03:38 2014
※ 引述《BigLoser (大鲁蛇)》之铭言:
: 资料库名称:mssql
: 内容/问题描述:
: table1 talbe2
: id a b c d
: 1 01 02 01 小明
: 2 02 02 02 小华
: 希望可以一段sql指令可以
: select table1.a, table1.b from table where id=1
: 得到结果
: a b
: 小明 小华
: 请问该怎麽下,谢谢
select (select d from table2 where c=a) a,
(select d from table2 where c=b) b
from table1
阿......好烂的方法XD
....
不知MSSQL有无支援这种query
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 203.65.163.29
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Database/M.1403604221.A.1AD.html
※ 编辑: bohei (203.65.163.29), 06/24/2014 18:12:50