ÇóÌõsqlÓï¾ä,SQLÃæÊÔÌâÄ¿£¬
--ÇóÌõsqlÓï¾ä£º
-- ÒªÇó£º1.°´ÕÕGroup_OutDate×Ö¶ÎÅÅÐò £¬µÃµ½Ç°5Ìõ¼Ç¼
-- 2.Group_Name×ֶεÄÖµ²»ÄÜÖظ´
SELECT TOP 5 * from
( SELECT DISTINCT Group_Name ,
(SELECT TOP 1 Group_ID from AA_Sell_Group AS b WHERE b.Group_Name=a.Group_Name)
AS Group_ID from dbo.AA_Sell_Group AS a) AS ff --²»Öظ´µÄÊý¾Ý
JOIN AA_Sell_Group AS cc
ON ff.Group_ID = cc.Group_ID
ORDER BY cc.Group_OutDate DESC --ʱ¼äÅÅÐò
--ok
Ïà¹ØÎĵµ£º
SQL Server .NET Framework Êý¾ÝÌṩ³ÌÐò (SqlClient) Ìṩ¾ÛºÏº¯Êý¡£¾ÛºÏº¯Êý¶ÔÒ»×éÊäÈëÖµÖ´ÐмÆËã²¢·µ»ØÒ»¸öÖµ¡£ÕâЩº¯ÊýλÓÚ SqlServer ÃüÃû¿Õ¼äÖУ¬¸ÃÃüÃû¿Õ¼äÔÚÄúʹÓà SqlClient ʱ¿ÉÓá£Ìṩ³ÌÐòµÄÃüÃû¿Õ¼äÊôÐÔʹʵÌå¿ò¼Ü¿ÉÒÔÈ·¶¨´ËÌṩ³ÌÐò¶ÔÌض¨¹¹Ô죨ÈçÀàÐͺͺ¯Êý£©Ê¹ÓÃÄĸöǰ׺¡£
ϱíÏÔʾ SqlClient ¾ÛºÏº¯Êý¡£ ......
½ñÌìÓÖ¿´µ½Ð¼ÓƵÄͬÊ·¢¹ýÀ´µÄÒ»¶ÎSQLÓï¾ä£¬»¹ÊÇÀÏÎÊÌ⣬ʱ¼ä¶Ô±ÈÖ±½ÓÓôóÓÚСÓںš£Ì¾ÁËÉùÆøºó£¬ÊÖ¶¯¸ø¸Ä³ÉdatediffÁË£¬¿ÉÊÇÒ»ÔËÐгö´í£¬´íÎóÌáʾÈçÏ£º
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting datetime from character string.
ΪÁË˵Ã÷·½±ã£¬ÕâÀï¾Í¼ò»¯Ò»¸öÀý×ÓºÃÁË¡£
create tab ......
select getdate()
ÊÇÏÔʾµ±Ç°ÏµÍ³Ê±¼ä£¬Êä³öµÄÈÕÆÚ¸ñʽÓë±¾»úÈÕÆÚ¸ñʽÓйأ¬¼ÙÈëÄãÏëÔÚʲôÇé¿ö϶¼ÏÔʾ³É2006-12-15 10:37:00ÕâÖÖÐÎʽÔòÐèҪת»»Ò»ÏÂ
select convert(varchar(30),getdate(),20)
ÏÔʾÊÇÐÇÆÚ¼¸µÄÓï¾äÊÇ
select datename(weekday,getdate())
ÈÕÆÚ¼ÓÐÇÆڵĻ°Ö±½Ó¼ÓÔÚÒ»¿é¾Í¿ÉÒÔÁË
select convert(varcha ......
SQL Server 2005 Áª»ú´ÔÊ飨2008 Äê 11 Ô£©
SQL Server 2005 µÄĬÈÏʵÀýºÍÃüÃûʵÀýµÄÎļþλÖÃ
¸üÐÂÈÕÆÚ£º 2005 Äê 12 Ô 5 ÈÕ
Microsoft SQL Server 2005 µÄ°²×°°üº¬Ò»¸ö»ò¶à¸öµ¥¶ÀµÄʵÀý¡£ÎÞÂÛÊÇĬÈϵĻ¹ÊÇÃüÃûµÄʵÀý£¬¶¼ÓÐ×Ô¼ºµÄÒ»Ì׳ÌÐòÎļþºÍÊý¾ÝÎļþ£¬ÒÔ¼°Ò»Ì×ÔÚ¼ÆËã»úÉϵÄËùÓÐʵÀýÖ®¼ä¹²ÏíµÄ¹«¹²Îļþ¡£
¶ÔÓÚ°üº ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£ ......