±íA
guiGeID shangPinID yanSe chiMa
1 1001 °×É« 37
2 1001 °×É« 37
3 1002 ºÚÉ« 42
4 1002 ºÚÉ« 42
5 1002 °×É« 37
6 1003 °×É« 37
7 1004 °×É« 37
ÄÜ·ñ¸ù¾Ý±íA²éѯ³ö shangPinID¡¢yanSe¡¢chiMa ÍêÈ«ÏàͬµÄËùÓÐÐÅÏ¢
²¢ÇÒ¸ù¾Ý shangPinID ÅÅÐò
¸ù¾ÝÉϱíµÃµ½µÄÐÅÏ¢Ó¦¸ÃÈçÏÂ
guiGeID shangPinID yanSe chiMa
1 1001 °×É« 37
2 1001 °×É« 37
3 1002 ºÚÉ« 42
4 1002 ºÚÉ« 42
SQL code:
select *
from tb t
where
(select count(1)
from tb
where shangPinID=t.shangPinID and yanSe=t.yanSe and chiMa=t.chiMa
)>1
SQL code:
-- =============================================
-- Author: T.O.P
-- Create date: 2009/11/26
-- Version: SQL SERVER 2005
-- =============================================
declare @TB1 table([guiGeID] int,[shangPinID] int,[yanSe] varchar(4),[chiMa] int)
insert @TB1
select 1,1001,'°×É«',37 union all
select 2,1001,'°×É«',37 union all
select 3,1002,'ºÚÉ«',42 union all
select 4,1002,'ºÚÉ«',42 union all
select 5,1002,'°×É«',37 union all
select 6,1003,'°×É«',37 union all
select 7,1004,'°×É«',37
select *
from @TB1 a
where 1<(select count(1) from @tb1 where a.
ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд
ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......