读书人

请问这样一个语句如何写

发布时间: 2012-01-31 21:28:41 作者: rapoo

请教这样一个语句怎么写
三个表,mst4100c,mst4000c,mst2000c
都有字段 图号:headno 状态: status_code


要提取mst2000c中状态不为X0(停用)的图号且存在于mst4000c中的图号,作为mst4100c的图号

如何写呢?

[解决办法]
select a.* from mst2000c a join mst4000c b on a.headno=b.headno where b.status_code <> 'X0 '
[解决办法]
select a.* from mst4100c a, mst2000c b where a.headno = b.headno and b.status_code <> 'XO '

读书人网 >SQL Server

热点推荐