日期:2014-05-17 浏览次数:20474 次
create table DBTest (OID int,Oname nvarchar(100),PID int,Com nvarchar(100)) insert into DBTest values ('12345','ABC','364','CZZXXCC') insert into DBTest values ('12346','ABC','364','EZZXXEE') insert into DBTest values ('12350','DFGFG','362','CCZZXXDD') insert into DBTest values ('12351','DFGFG','365','EEZZXXFF') insert into DBTest values ('12355','XXCVD','362','WWZZXXD') insert into DBTest values ('12356','XXCVD','364','GGZZXXV')
SELECT a.* FROM dbtest a INNER JOIN dbtest b ON a.oname=b.oname WHERE a.pid<>b.pid /* OID Oname PID Com ----------- ---------------------------------------------------------------- ----------- ---------------------------------------------------------------- 12351 DFGFG 365 EEZZXXFF 12350 DFGFG 362 CCZZXXDD 12356 XXCVD 364 GGZZXXV 12355 XXCVD 362 WWZZXXD (4 行受影响) */