日期:2014-05-18  浏览次数:20548 次

请大家帮忙看看这个SQL语句
现在有这样的一个数据表(SP)
供应商号(Sno) 零件号(Pno) 零件数量(Qty)

查询至少包含了供应商号"168"所供应的全部零件的Sno
请大家帮忙看看这个SQL语句怎么填写完整?谢谢

select Sno
 from SP SPX
where ___
(select * from SP spy where ____and not exists
(select * from SP spz where ____));



------解决方案--------------------
SQL code

select * from 
(select * from SP where (select count(*) from SP group by id having Sno='168')>=1)

a where 条件

------解决方案--------------------
select * from sp where charindex('168',sno)>0
------解决方案--------------------
SQL code
select * from sp where charindex( '168',sno) >0
--
select * from sp where sno like '%168%'
select * from sp where sno like '168%'
select * from sp where sno like '%168'

------解决方案--------------------
select Sno
 from SP SPX
where ___
(select * from SP spy where ____and not exists
(select * from SP spz where ____));
楼主意思就用这个格式?