Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlÖظ´Êý¾Ý´¦Àí£¬ÓÐΨһID£¬formidÓÐÖظ´,ÁôÒ»Ìõ

/*sqlÖظ´Êý¾Ý´¦Àí£¬ÓÐΨһID£¬formidÓÐÖظ´*/
/*²é³öÖظ´µÄfromid*/
select formid from GaiaSaver_BUG group by formid having count(*)>1
/*ɾ³ýÖظ´formid£¬Ö»ÁôÒ»Ìõ*/
delete from GaiaSaver_BUG  where ID not in
(select   min(ID) as ID  from  GaiaSaver_BUG  group by formid)


Ïà¹ØÎĵµ£º

Sql Server 2005 ͳ¼ÆÐÅÏ¢ÓÃ;

1, ʲôÊÇͳ¼ÆÐÅÏ¢ 
    ÒÔÏÂÊǹٷ½µÄ¶Ôͳ¼ÆÐÅÏ¢µÄÃèÊö£º
     °´ÕÕĬÈÏÉèÖã¬Èç¹û±íÖеÄijÁÐûÓÐË÷Òý£¬ÔòSQL Server»á×Ô¶¯Îª¸ÃÁд´½¨Í³¼Æ¡£È»ºó£¬²éѯÓÅ»¯Æ÷ÆÀ¹À¸ÃÁÐÖÐÊý¾Ý·Ö²¼·¶Î§µÄͳ¼ÆÐÅÏ¢£¬ÒÔÑ¡ÔñÒ»¸ö¸üΪÓÐЧµÄ²éѯ´¦Àí·½°¸¡£·Ö±æ×Ô¶¯´´½¨µÄͳ¼ÆºÜ¼òµ¥£¬ÔÚSQL Serve ......

Sql Server²éѯÊý¾Ý¼¯ÐÐÁл¥»»

Ðл»ÁУº
--> Éú³É²âÊÔÊý¾Ý±í: [tb]
IF OBJECT_ID('[tb]') IS NOT NULL
    DROP TABLE [tb]
GO
CREATE TABLE [tb] ([a] [int],[b] [int],[c] [int])
INSERT INTO [tb]
SELECT '3','9','5' UNION ALL
SELECT '5','2','7' UNION ALL
SELECT '6','3','8'
--SELECT * from [tb]
-->SQL²éѯÈçÏ ......

Ò»²½Ò»²½Ñ§Linq to sql£¨ËÄ£©£º²éѯ¾ä·¨


select
 
ÃèÊö£º²éѯ¹Ë¿ÍµÄ¹«Ë¾Ãû¡¢µØÖ·ÐÅÏ¢
²éѯ¾ä·¨£º
var ¹¹½¨ÄäÃûÀàÐÍ1 = from c in ctx.Customers
                      select new
    ......

SQLÖÐ groupbyºÍhavingµÄÇø±ð

½éÉÜGROUP BY ºÍ HAVING ×Ó¾äÇ°£¬ÎÒÃDZØÐèÏȽ²½²sqlÓïÑÔÖÐÒ»ÖÖÌØÊâµÄº¯Êý:¾ÛºÏº¯Êý£¬ÀýÈçSUM, COUNT, MAX, AVGµÈ¡£ÕâЩº¯ÊýºÍÆäËüº¯ÊýµÄ¸ù±¾Çø±ð¾ÍÊÇËüÃÇÒ»°ã×÷ÓÃÔÚ¶àÌõ¼Ç¼ÉÏ¡£
 SELECT SUM(population) from bbc
ÕâÀïµÄSUM×÷ÓÃÔÚËùÓзµ»Ø¼Ç¼µÄpopulation×Ö¶ÎÉÏ£¬½á¹û¾ÍÊǸòéѯֻ·µ»ØÒ»¸ö½á¹û£¬¼´ËùÓйú¼ÒµÄ×ÜÈË¿ ......

Sqlʱ¼ä¸ñʽ»¯·½·¨(ת)


Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select
CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100),
GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3):
16/05/06
Select CONVERT(varchar(100), GETDATE(), 4): 16.05.06
Select
CON ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ