如图,
select a.Hostname,a.Loginname,a.Software,b.[Software Name] from app a,lc b where a.hostname=b.[device name] and a.loginname=b.[login name]
,上图是我根据sql 查询出的数据,现在要把software 和 [Software Name]能对应上的找出来,比如HostName 为
AMYHU 的查询结果为:http://hi.csdn.net/attachment/201103/15/0_1300173659b828.gif ,注意: 打个比方:software='Adobe Photoshop 4.0' [software name]='Adobe Photoshop ' 这个也能对得上,所以不能用=查询
select a.Hostname,a.Loginname,a.Software,b.[Software Name] from app a,lc b where a.hostname=b.[device name] and a.loginname=b.[login name]
,上图是我根据sql 查询出的数据,现在要把software 和 [Software Name]能对应上的找出来,比如HostName 为
AMYHU 的查询结果为:http://hi.csdn.net/attachment/201103/15/0_1300173659b828.gif ,注意: 打个比方:software='Adobe Photoshop 4.0' [software name]='Adobe Photoshop ' 这个也能对得上,所以不能用=查询
*
from
tb t
where
exists(select 1 from tb where HostName!=t.HostName and software=software and [Software Name]=t.[Software Name])
select * from (
select a.Hostname,a.Loginname,a.Software,b.[Software Name] from app a,lc b where
a.hostname=b.[device name] and a.loginname=b.[login name]
) a where a.Software like b.[Software Name]+'%'
select a.Hostname,a.Loginname,a.Software,b.[Software Name] from app a,lc b where
a.hostname=b.[device name] and a.loginname=b.[login name]
) a where '%'+a.Software+'%' like '%'+b.[Software Name]+'%'