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

Õâ¸ösqlÓï¾äÔõôд

±ÈÈçÒ»¸ö±íÓÐa,b,c,d£¬e 5¸ö×Ö¶Î
·µ»Ø a=1,b=1,d=1µÄ¼Ç¼Êý·Ö±ðÓжàÉÙ¸ö¡£·µ»ØÒ»¸öÒ»ÐеÄtable
SQL code:
select id='a',¼Ç¼Êý=count(*) from table where a=1
union all
select id='b',¼Ç¼Êý=count(*) from table where b=1
union all
select id='d',¼Ç¼Êý=count(*) from table where d=1


select a=Sum(case a when 1 then 1 else 0),
b=Sum(case b when 1 then 1 else 0),
c=Sum(case c when 1 then 1 else 0)
from tb

select a=Sum(case a when 1 then 1 else 0 end),
b=Sum(case b when 1 then 1 else 0 end ),
c=Sum(case c when 1 then 1 else 0 end )
from tb
¸Õ²ÅÉÙ¸öend

ÒýÓÃ
SQL codeselect id='a',¼Ç¼Êý=count(*)fromtablewhere a=1unionallselect id='b',¼Ç¼Êý=count(*)fromtablewhere b=1unionallselect id='d',¼Ç¼Êý=count(*)fromtablewhere d=1

ÉÏÃæÁ½ÖÖ¶¼ÐУ¬¸öÈ˱ȽÏϲ»¶£±Â¥ÕâÖÖ¡£

ÒýÓÃ
ÒýÓà 1 Â¥ feixianxxx µÄ»Ø¸´:
SQL codeselect id='a',¼Ç¼Êý=count(*)fromtablewhere a=1unionallselect id='b',¼Ç¼Êý=count(*)fromtablewhere b=1unionallselect id='d',¼Ç¼Êý=count(*)fromtablewhere d=1

ÉÏÃæÁ½ÖÖ¶¼ÐУ¬¸öÈ˱ȽÏϲ»¶£±Â¥ÕâÖÖ¡£

1Â¥×ÝÏòÅÅÁÐ
2Â¥ºáÏòÅÅÁÐ

²»¶Ïѧϰ

ѧϰ

select Èý¸öͳ¼ÆºÃµÄÊý¾ÍÐÐÁ


Ïà¹ØÎÊ´ð£º

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

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

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

csvÎļþת»»³Ésqlµ¼Èëµ½Êý¾Ý¿â£¬Ã»ÓÐÊý¾ÝΪºÎ£¿

Ö´ÐеÄ˳Ðò£º
1£©Îļþä¯ÀÀ¿ò£¨Ñ¡ÔñÎļþʹÓã©
Ñ¡ÔñºÃÎļþºó
µã»÷Ò»¸öµ¼Èë°´Å¥µÄʱºò £¬°ÑÉÏÃæÉÏ´«¿òÀïµÄcsvÎļþÒÔÒ»¸öIDΪÎļþÃû£¬ÉÏ´«µ½**/**Îļþ¼ÐÏÂ
2£©¶ÁÈ¡Õâ¸öÎļþ¼ÐϵÄcsvµÄÎļþ£¬×ª»»³Ésql
3 ......

sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿

sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿ÎÒÖ¸µÄÊÇfor´¥·¢Æ÷£¬ÄÇÆäËûµÄÄØ£¿£¿
ʲôÒâ˼£¿

¿ÉÒÔµÄ

10¸ö¶¼Ã»ÎÊÌâ

¿ÉÊÇÎÒдÁËÁ½¸öfor insert ´¥·¢Æ÷£¬Ôì³É½ø³Ì×èÈûÁËÄØ£¿Ôõô°ìÄØ£¿Çë¸ßÈËÖ¸µã
......

ÇóÒ»Ìõoracle¶à±í²éѯµÄsql£¬Çó¸ßÊÖÃDz»ÁߴͽÌ~

table1:
uID    uName
1      СÀî 
2      СÕÅ

table2:
pID  uID  type
1    1    H1
2    ......

OracleÖвéѯ×òÌì00£º00µ½½ñÌì00£º00µÄsqlÔõôд£¿

ÔÚOracleÖУ¬ÎÒÏë²éϵͳʱ¼äÒ»ÌìµÄÊý¾Ý£¬Ê¹ÓÃÕâ¸öÓï¾ä
select * from tablename
where create_time>SYSDATE-1
and create_time <SYSDATE


ÎÒÏë²é×òÌì00£º00µ½½ñÌì00£º00µÄsqlÔõôд£¬
» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ