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

sqlͳ¼ÆÓï¾ä

ÔÚaccessÊý¾Ý¿â£¬×ö¸öͳ¼Æ¡£Äܲ»ÄÜÓÃÌõsqlÓï¾ä×ö£¿Àý×ÓÈçÏ¡£
ÐԱ𡡡¡Ãñ×å
Å®      ºº
Å®      »Ø
ÄР     Âú
ÄР     ºº
×ö¸öͳ¼Æ£º
Ãñ×å/ÐÔ±ð  ÄР Å®
ºº          1  1
»Ø          0  1
Âú          1  0
Óö¼ûÕÅÈýÀîËÄ····················

ÐÐתÁз···············

SQL code:
declare @TT table
(
ÐÔ±ð char(2),
Ãñ×å char(10)
)
insert into @TT select 'Å®','ºº'
union all select 'Å®','»Ø'
union all select 'ÄÐ','Âú'
union all select 'ÄÐ','ºº'

select Ãñ×å,
sum(case when ÐÔ±ð='Å®' then 1 else 0 end) 'Å®',
sum(case when ÐÔ±ð='ÄÐ' then 1 else 0 end) 'ÄÐ'
from @TT group by Ãñ×å


SQL code:
declare @TT table
(
ÐÔ±ð char(2),
Ãñ×å char(10)
)
insert into @TT select 'Å®','ºº'
union all select 'Å®','»Ø'
union all select 'ÄÐ','Âú'
union all select 'ÄÐ','ºº'

select Ãñ×å,
sum(case when ÐÔ±ð='ÄÐ' then 1 el


Ïà¹ØÎÊ´ð£º

ÃÅÍ⺺ÇóÖú...¹ØÓÚºǫ́+SQL+ASP

....½Óµ½Ò»¸öС³ÌÐò..¹¤×÷Ô­À´´ó¸ÅÊÇÕâÑùµÄ...ǰ̨ÊÇWEB·þÎñÆ÷.¼Ü¹¹¾ÍÊÇASP+SQL..ǰ̨ÓÉASPÏòSQLÌí¼Ó·þÎñÀà±ð(±íµ¥).È»ºóÓÖºǫ́³ÌÐò¶ÁÈ¡±íµ¥..Ҫʵʱ¶ÁÈ¡..È»ºóÏÔʾÔÚ·þÎñÆ÷ÉÏÃæ..´ÓÀíÂÛÉÏÃæÄÜÐÐͨ²»?Èç¹û¿ÉÒÔ..ºǫ́ ......

ÇóSQL£¿

´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e 
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......

¹ØÓÚgroup byµÄsqlÓï¾ä£¿

  with adod_dict do
    begin
    close;
    commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......

SQLÓï¾äÎÊÌ⣬¸ßÊÖ°ïæ£¡£¡

½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿

21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......

C# Á¬½ÓSQLÊý¾Ý¿â³£ÓõÄÁ¬½Ó×Ö·û´®¸ÃÈçºÎд£¿

£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";   
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ