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

sqlÓï·¨caseÓ÷¨

CASE ¿ÉÄÜÊÇ SQL Öб»ÎóÓÃ×î¶àµÄ¹Ø¼ü×ÖÖ®Ò»¡£ËäÈ»Äã¿ÉÄÜÒÔÇ°ÓùýÕâ¸ö¹Ø¼ü×ÖÀ´´´½¨×ֶΣ¬µ«ÊÇËü»¹¾ßÓиü¶àÓ÷¨¡£ÀýÈ磬Äã¿ÉÒÔÔÚ WHERE 
×Ó¾äÖÐʹÓà CASE¡£ 
Ê×ÏÈÈÃÎÒÃÇ¿´Ò»Ï CASE µÄÓï·¨¡£ÔÚÒ»°ãµÄ SELECT ÖУ¬ÆäÓï·¨ÈçÏ£º 
SELECT = 
CASE 
WHEN THEN 
WHEN THEN 
ELSE 
END 
ÔÚÉÏÃæµÄ´úÂëÖÐÐèÒªÓþßÌåµÄ²ÎÊý´úÌæ¼âÀ¨ºÅÖеÄÄÚÈÝ¡£ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£º 
USE pubs 
GO 
SELECT 
Title, 
'Price Range' = 
CASE 
WHEN price IS NULL THEN 'Unpriced' 
WHEN price < 10 THEN 'Bargain' 
WHEN price BETWEEN 10 and 20 THEN 'Average' 
ELSE 'Gift to impress relatives' 
END 
from titles 
ORDER BY price 
GO 
¶ÔÓÚinformix²»ÄÜÓÃÒÔÉÏÐÎʽ£¬¿ÉÒÔÈçÏ£º 
USE pubs 
GO 
SELECT 
Title, 
CASE 
WHEN price IS NULL THEN 'Unpriced' 
WHEN price < 10 THEN 'Bargain' 
WHEN price BETWEEN 10 and 20 THEN 'Average' 
ELSE 'Gift to impress relatives' 
END 
Price Range 
from titles 
ORDER BY price 
GO 
ÕâÊÇ CASE µÄµäÐÍÓ÷¨£¬µ«ÊÇʹÓà CASE Æäʵ¿ÉÒÔ×ö¸ü¶àµÄÊÂÇé¡£±È·½ËµÏÂÃæµÄ GROUP BY ×Ó¾äÖÐµÄ CASE£º 
SELECT 'Number of Titles', Count(*) 
from titles 
GROUP BY 
CASE 
WHEN price IS NULL THEN 'Unpriced' 
WHEN price < 10 THEN 'Bargain' 
WHEN price BETWEEN 10 and 20 THEN 'Average' 
ELSE 'Gift to impress relatives' 
END 
GO 
ÄãÉõÖÁ»¹¿ÉÒÔ×éºÏÕâЩѡÏÌí¼ÓÒ»¸ö ORDER BY ×Ӿ䣬ÈçÏÂËùʾ£º 
USE pubs 
GO 
SELECT 
CASE 
WHEN price IS NULL THEN 'Unpriced' 
WHEN price < 10 THEN 'Bargain' 
WHEN price BETWEEN 10 and 20 THEN 'Average' 
ELSE 'Gift to impress relatives' 
END AS Range, 
Title 
from titles 
GROUP BY 
CASE 
WHEN price IS NULL THEN 'Unpriced' 
WHEN price < 10 THEN 'Bargain' 
WHEN price BETWEEN 10 and 20 THEN 'Average' 
ELSE 'Gift to impre


Ïà¹ØÎĵµ£º

java¡¢C#ÖÐSqlÓï¾ä´«²ÎµÄд·¨¼°ÒâÒå

 SqlserverÕⶫÎ÷ûÉÙ¸úËû´ò½»µÀ,¸Õѧ¿ª·¢ÓïÑÔʱ¾ÍÒѾ­¸úËû½Ó´¥ÁË,²»ÒªËµºÜ¾«Í¨,µ«¾ÍÓï·¨»¹ËãÊÇÊìϤ,µ«ÏÖÔÚ¿ªÊ¼Ð´C#,·¢ÏÖºÜC#¶àÁËÒ»ÖÖSqlServerµÄ²ÎÊý´«È뷽ʽ,ÒÔÍùÎÒÃdz£³£¶ÔÒª´«²ÎµÄSqlÓï¾ä¶¼ÊÇÖ±½Óͨ¹ýÆ´´ÕSqlÓï¾äµÄ·½Ê½À´ÊµÏÖ,µ«ÏÖÔÚC#ΪʲôҪרÃÅ×öÒ»¸öSql²ÎÊýµÄÀàÀ´ÊµÏÖÄØ,¾­¹ý²éÕÒ²ÅÖªµÀ,ÕâÑù×öÊÇÓеÀÀíµÄ,Ò»Ê ......

SQL½Å±¾×Ö¶Î[content]ºÍcontentÇø±ð

      ½ñÌìÎÒÔÚSQL Server 2005ÖÐÓýű¾´´½¨Ò»ÕÅ±í£¬²é×ÊÁÏ·¢ÏÖÓеĽű¾ÖÐ×Ö¶ÎÓмÓ[]ÖзûºÅ£¬ÎÒÎÊÁ˶¬¼¾£¬µÃÖªÊÇÕâ»ØÊ£¬ÓÃ[]µÄ×Ö¶ÎÃû£¬¼´±ãÊÇsql¹Ø¼ü×ÖÒ²¿ÉÒÔ×÷Ϊ×Ö¶ÎÃû£¬²»»á±¨´í¡£
      SQL ServerÀïµÄ±íÖÐÌí¼ÓÒ»¸ö×ֶΣ¬È磺timeϵͳ»á×Ô¶¯¼ÓÒ»¶Ô·½À¨ºÅ¼´£º[time] ......

ÔÚVB2008 ËٳɰæÖÐʹÓòÎÊý»¯SQL²éѯÓï¾äÎÞЧ

  ×î½ü¸Õѧ»áÔÚVB2008 ÖÐʹÓòÎÊý»¯SQLÓï¾ä£¬ÓÚÊÇÂíÉÏÓõ½´úÂëÖУ¬È´Åöµ½²é²»µ½ÈκÎÊý¾ÝµÄÇé¿ö£¬¾À½áÁ˺ü¸Ì죬»¹ÊÇûÓиãÃ÷°×£¬²îµãÍÂѪ¡£²»µÃÒÑ»¹ÊÇÏÈÔÚ´úÂëÖÐʹÓÃ×Ö·û´®Æ´½ÓµÄSQLÓï¾ä¡£
  °üº¬²ÎÊý»¯SQLÓï¾äµÄ´úÂëÈçÏ£º
            Dim cmSl As N ......

sql º¯Êý×ܽá

sql º¯Êý×ܽá
³£ÓõÄ×Ö·û´®º¯ÊýÓУº
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ......

sql ³£ÓÃ

¹«Ë¾×éÖ¯SQLˮƽ¿¼ÊÔ£¬¿´ÁËд½Ì²Ä£¬Ð´Á˵ã×ܽᷢÉÏÀ´¸ú´ó¼Ò·ÖÏí¡£
ÎÒ¹«Ë¾Ê¹ÓõÄÊÇSybase ASE12.5£¬ËùÒÔÏÂÃæµÄһЩÌØÐÔÊÇÕë¶ÔSybase ASEµÄ¡£
Ò»£ºSQL Bisic
1£ºSQL(Structured Quary Language)ÌØÐÔ£º
a£º±ê×¼»¯
b£º·Ç¹ý³Ì»¯µÄ
c£º¿ÉÓÅ»¯µÄ
d£ºÃæÏò¼¯ºÏ²Ù×÷µÄ
2£ºASEÖеÄÊý¾ÝÀàÐÍ
a£ºNumberic
b£ºCharacter
c£ºDat ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ