SQL Having×Ó¾ä
SELECT
count
(
userName
)
from
`userInfo`
GROUP
BY
userName
HAVING
count
(
userName
)
>
1¡£
Õâ¸öHavingÒ»¶¨Òª·ÅÔÚGROUP BYµÄºóÃæ¡£
¶øÇÒºÜÌØÊâµÄÇé¿öÊÇÔÚÓÐgroup byµÄʱºò£¬ÊDz»ÄÜÓõ½where×Ó¾äµÄ¡£¶øÇÒHaving×Ó¾äÒ»°ãÊÇ·ÅÔÚÆäËû×Ó¾äµÄºóÃæµÄ¡£
µ±ÎÒÃÇÑ¡²»Ö»Ò»¸öÀ¸Î»£¬ÇÒÆäÖÐÖÁÉÙÒ»¸öÀ¸Î»Óаüº¬º¯ÊýµÄÔËÓÃʱ£¬
ÎÒÃǾÍÐèÒªÓõ½
GROUP BY
Õâ¸öÖ¸Áî¡£
SELECT "À¸Î»1", SUM("À¸Î»2")
from "±í¸ñÃû"
GROUP BY "À¸Î»1"
HAVING (º¯ÊýÌõ¼þ)
SELECT * from `userInfo` group by `userName` having count(userName) = 1 ;
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
SQL Server°²×°Îļþ¹ÒÆð:
ÔÚÖØÐ°²×°Ö÷SQLServer2000ʱ»òÊÇ´ò²¹¶¡Ê±,×ÜÊÇ»áÓöµ½SQLServer°²×°Îļþ¹ÒÆð¡£
ÔÚÔËÐд°¿ÚÊäÈëregedit£¬´ò¿ª×¢²á±í±à¼Æ÷£¬ÔÚHKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session ManagerÖÐÕÒµ½PendingFileRenameOperations£¬É¾³ý¸Ã¼üÖµ£¨Õâ¸ö¼üÖµÊǰ²×°³ÌÐòÔݹÒÏîÄ¿£¬Ö»ÒªÕÒµ½¶ÔÓ¦µÄÓ¦Óó ......
³õ´ÎʹÓÃpb10µÄÅóÓÑÎÞ·¨Ë³ÀûÁ¬½Óµ½sql server£¬Ò»·½ÃæÃ»ÓÐÁËmssql serverרÓýӿÚÁË£¬ÁíÒ»·½ÃæÊý¾Ý¿â¹ÜÀíϵͳ(DBMS)»»³ÉÁË“OLE DB”£¬ÅäÖÃÆðÀ´Óе㲻˳ÊÖ£¡ÏÂÃæ¾ÍÀ´½éÉÜpb10ÖÐÓÃOLE DBÁ¬½Ósql 2000Êý¾Ý¿â¡£
ÔÚ°²×°pb10µÄʱºòÑ¡Ôñcustom/full·½Ê½°²×°£¨Ä¬Èϵݲװ·½Ê½²»»á°²×°ole db½Ó¿Ú£©£¬next£¡·Èç¹ûÄãûÓа ......
ÔÚsql server2005ÖÐÔõô½øÐжàÖµÓë¶àÖµÖ®¼äµÄ±È½Ï£¿¿ÉÒԱȽÏÂð£¿
ÀýÈ磺
ÎÒÒªÖ¤Ã÷1£¬2£¬3£¬4£¬5£¨ÔÚ±íÖвéѯ³öµÄÖµ£©Óë3£¬2£¬6£¬5£¨×Ô¶¨Òå²ÎÊý£©Á½ÌõÊý¾ÝÖÐÓÐÏàͬµÄÖµ£¬²¢½«ÏàֵͬµÄÁеÄÏàÓ¦±íÐÅÏ¢ÓÃprint´òÓ¡³öÀ´
×¢Ò⣬²»Äܵ¥¸ö±È½Ï……
²»ÖªµÀ¿É²»¿É²éѯ³öÀ´£¬ Çë¸÷λ¸ßÊÖ°ï°ïæ……
......
ÕªÒª
¶ÔÓÚSQL ServerÖеÄÔ¼Êø£¬Ïë±Ø´ó¼Ò²¢²»ÊǺÜİÉú¡£µ«ÊÇÔ¼ÊøÖÐÕæÕýµÄÄÚºÊÇʲô£¬²¢²»ÊǺܶàÈ˶¼ºÜÇå³þµÄ¡£±¾ÎÄÒÔÏêϸµÄÎÄ×ÖÀ´½éÉÜÁËʲôÊÇÔ¼Êø£¬ÒÔ¼°ÈçºÎÔÚÊý¾Ý¿â±à³ÌÖÐÓ¦ÓúÍʹÓÃÕâÐ©Ô¼Êø£¬À´´ïµ½¸üºÃµÄ±à³ÌЧ¹û¡££¨±¾ÎIJ¿·ÖÄÚÈݲο¼ÁËSQL ServerÁª»úÊֲᣩ
ÄÚÈÝ
Êý¾ÝÍêÕûÐÔ·ÖÀà
ʵÌåÍêÕûÐÔ
&nb ......