sqlÓï¾äÎÊÌâ
ÓÐÒ»¸ö±íAA name tj 1 a 1 b 1 c 2 a 2 d 3 b ÒªÇóµ±tj×ֶεÄÖµ¼ÈµÈÓÚaÓÖµÈÓÚcʱ£¨tj = ¡®a¡¯ÓÖÒªtj = ¡®b¡¯£© Ò²¾ÍÊÇ˵ÎҵIJéѯÌõ¼þÊÇa¡¢c£¬ÎÒÒª²éµÄ½á¹ûÊÇ1
SQL code: select name from ( select distinct name from aa where tj ='a' union all select distinct name from aa where tj ='b' ) t group by name having count(1) = 2 SQL code: select * from AA where tj='a' and tj='c'ÒýÓà SQL codeselect*from AAwhere tj='a'and tj='c' Àí½â錯誤.´ó烏龜Õý½â.ÒýÓà SQL codeselect namefrom (selectdistinct namefrom aawhere tj='a'unionallselectdistinct namefrom aawhere tj='b' ) tgroupby namehavingcount(1)=2 up SQL code: create table aa(name int, tj varchar(10)) insert into aa values(1 , 'a') insert into aa values(1 , 'b') insert into aa values(1 , 'c') ins
Ïà¹ØÎÊ´ð£º
ÎÒ°²×°SQL SERVER2008µÄʱºòÑ¡ÔñWINDOWSÉí·ÝÑéÖ¤Á¬½ÓµÄ£¬ÎÒ²»ÖªµÀÔõôдÁ¬½Ó¡£¡£¡£ »¹ÓÐÎÒÏë¸Ä³ÉSQL SERVERÉí·ÝÑéÖ¤Ôõô¸Ä£¿£¿ лл´ó¼ÒÁË£¡ XML code: <configuration> <appSettings> & ......
@s='S1,S2,S12,S23'; ½«@sÀïÃæµÄS1,S2Ìæ»»³É´¦Àí£¬Î´´¦Àí À´ÕßÓзÖ. REPLACE(@s,'S1,S2','´¦Àí,δ´¦Àí') REPLACE ²»ºÃÓà ×Ô¼ºÊÔÏ SQL code: declare @s ......
ÔõôʹÎÒÿ´Î²»ÊǸüÐÂÊý¾Ý¿â ¶øÊǸ²¸ÇÉϴεÄËùÓмÇÂ¼ÄØ£¡ ÒòΪÓÐʱºòʱ¼äÌõ¼þ²»Í¬ SQL code: select * from hwouttb where CAST(REPLACE(REPLACE(REPLACE(outdate,'Äê','-' ),'ÔÂ','-'),'ÈÕ','') AS ......
ÓÐʱºòÔÚÊý¾ÝÖвéѯÊý¾ÝµÄʱºò¿¼ÂÇÐÔÄÜÎÊÌ⣬»á½«¸´ÔÓÓï¾ä²ð·Ö»ò½èÓÃÁÙʱ±íÀ´¶à´Î²éѯ×îÖյõ½ÏëÒªµÄÊý¾Ý£¬ÏÖÔÚ½«ÕâЩ²éѯÄÚÈÝ×ö³É±¨±í£¬ÐèҪд¸öÓï¾äÒ»ÆøºÇ³É¡£ ÎÒÏëÎʵÄSQLÊÇ·ñ¿ÉÒÔÔÚ²éѯÓï¾äÒ»½áÊøºó£¬ÔÙ×Ô¶¯Ô ......
create trigger TR_Delete_pm_WorkCard on pm_WorkCard for delete as if @@rowcount=0 return begin tran update pm_PlanEntry set FDispatchQty=t4.FDispatchQty - t1.FDispat ......