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

SQL²éѯÏÔʾÎÊÌâ(2) - MS-SQL Server / »ù´¡Àà

ÓÐÒ»¸ö×Ö¶ÎA £¬ÀïÃæÊǾßÌåÊÇÊý×Ö£¬
ÎÒÏëÈÃËû²éѯÏÔʾʱ¼ÓÅÐ¶Ï ±ÈÈç £º0-100 ÏÔʾ³É£º1 £»101-200 ÏÔʾ³É£º2  
ÈçºÎʵÏÖ£¬²»Ê¤¸Ð¼¤£¡£¡£¡


ÒýÓÃ
ÓÐÒ»¸ö×Ö¶ÎA £¬ÀïÃæÊǾßÌåÊÇÊý×Ö£¬
ÎÒÏëÈÃËû²éѯÏÔʾʱ¼ÓÅÐ¶Ï ±ÈÈç £º0-100 ÏÔʾ³É£º1 £»101-200 ÏÔʾ³É£º2
ÈçºÎʵÏÖ£¬²»Ê¤¸Ð¼¤£¡£¡£¡

select case when col between 0 and 100 then 1 when col between 100 and 200 then 2 end from tb

SQL code:
select case when '0-100' then 1 else 0 end as'col1',
case when '101-200' then 2 else 0 end as 'col2'
from tb


SQL code:
select case when col between 0 and 100 then 1
when col between 100 and 200 then 2 end
from tb


select *,(select count(1) from tb where right(A,len(A) - charindex('-',A))<=right(t1.A,len(t1.A) - charindex('-',t1.A))) 
from tb t1 join tb t2 on right(t1.A,len(t1.A) - charindex('-',t1.A))+1 = left(t2.A,charindex ('-',t2.A) -1)



Ïà¹ØÎÊ´ð£º

ÇóÒ»sqlÓï¾ä - MS-SQL Server / ÒÉÄÑÎÊÌâ

ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄÇ°2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......

Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿ - MS-SQL Server / »ù´¡Àà

Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿
ÖÁÉٵø½¼Óµ½sqlserverÉÏ

¾ßÌåÔõôŪ°¡ ÎҵıÏÒµÉè¼ÆµÄÊý¾Ý¿âÊÇ´ÓÍøÉÏdownÏÂÀ´µÄ£¿£¿

Ä㻹²»ÈçÖ±½ÓÓÃsqlserverÄØ

º¯Êý¡¢´æ´¢¹ý³Ì¶¼µÃ¸ÄÁË¡£

sqlserverûÔõôÓùý¡£Ò²Ã»Óа²× ......

asp wap sqlÓï¾äÖлñÈ¡µÄºº×Ö²»ºÃÊ - Web ¿ª·¢ / ASP

SQL code:

rs.open "select * from guide where city_name='±±¾©' order by pai desc",conn,1,1
do while not rs.eof or rs.bof
¡£¡£
¡£¡£
¡£¡£
rs.movenext
loop
Õâ¸ösqlÓï¾äÔÚwapÕ¾Àï ±¾ÉíÓÐ ......

SQLÓï¾ä OR ´æ´¢¹ý³Ì£¿ - .NET¼¼Êõ / C#

Ö´ÐÐÊý¾Ý¿â²Ù×÷ʱ£¬Ö±½ÓÓÃSQL Óï¾äºÃһЩ »¹ÊÇÓô洢¹ý³Ì¸ü¼ÑÄØ£¿
¸÷ÊãÆð¼û
Õâ¸öµÄ¾ßÌåÎÊÌâ¾ßÌå·ÖÎö
¼òµ¥µÄselect ¡¢updateºÍinsertµ±È»sql½â¾öÁË
¸´ÔӵķÅÔÚsql·þÎñ¶ËÓ¦¸ÃºÃµã

Â¥Ö÷Çë²ÎÔÄ
http://msdn.micr ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ