首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

请问这样一个语句如何写

2012-01-31 
请教这样一个语句怎么写三个表,mst4100c,mst4000c,mst2000c都有字段图号:headno状态:status_code要提取mst

请教这样一个语句怎么写
三个表,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 '

热点排行