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

SQL¾­µäÃæÊÔÌâ¼°´ð°¸

1.Ò»µÀSQLÓï¾äÃæÊÔÌ⣬¹ØÓÚgroup by
±íÄÚÈÝ£º
2005-05-09 ʤ
2005-05-09 ʤ
2005-05-09 ¸º
2005-05-09 ¸º
2005-05-10 ʤ
2005-05-10 ¸º
2005-05-10 ¸º
Èç¹ûÒªÉú³ÉÏÂÁнá¹û, ¸ÃÈçºÎдsqlÓï¾ä?
            ʤ ¸º
2005-05-09 2 2
2005-05-10 1 2
------------------------------------------
create table #tmp(rq varchar(10),shengfu nchar(1))
insert into #tmp values('2005-05-09','ʤ')
insert into #tmp values('2005-05-09','ʤ')
insert into #tmp values('2005-05-09','¸º')
insert into #tmp values('2005-05-09','¸º')
insert into #tmp values('2005-05-10','ʤ')
insert into #tmp values('2005-05-10','¸º')
insert into #tmp values('2005-05-10','¸º')
1)select rq, sum(case when shengfu='ʤ' then 1 else 0 end)'ʤ',sum(case when shengfu='¸º' then 1 else 0 end)'¸º' from #tmp group by rq
2) select N.rq,N.勝,M.負 from (
select rq,勝=count(*) from #tmp where shengfu='ʤ'group by rq)N inner join
(select rq,負=count(*) from #tmp where shengfu='¸º'group by rq)M on N.rq=M.rq
3)select a.col001,a.a1 ʤ,b.b1 ¸º from
(select col001,count(col001) a1 from temp1 where col002='ʤ' group by col001) a,
(select col001,count(col001) b1 from temp1 where col002='¸º' group by col001) b
where a.col001=b.col001
2.Çë½ÌÒ»¸öÃæÊÔÖÐÓöµ½µÄSQLÓï¾äµÄ²éѯÎÊÌâ
±íÖÐÓÐA B CÈýÁÐ,ÓÃSQLÓï¾äʵÏÖ£ºµ±AÁдóÓÚBÁÐʱѡÔñAÁзñÔòÑ¡ÔñBÁУ¬µ±BÁдóÓÚCÁÐʱѡÔñBÁзñÔòÑ¡ÔñCÁС£
------------------------------------------
select (case when a>b then a else b end ),
(case when b>c then b esle c end)
from table_name
3.ÃæÊÔÌ⣺һ¸öÈÕÆÚÅжϵÄsqlÓï¾ä£¿
ÇëÈ¡³ötb_send±íÖÐÈÕÆÚ(SendTime×Ö¶Î)Ϊµ±ÌìµÄËùÓмǼ?(SendTime×Ö¶ÎΪdatetimeÐÍ£¬°üº¬ÈÕÆÚÓëʱ¼ä)
------------------------------------------
select * from tb where datediff(dd,SendTime,getdate())=0
4.ÓÐÒ»ÕÅ±í£¬ÀïÃæÓÐ3¸ö×ֶΣºÓïÎÄ£¬Êýѧ£¬Ó¢Óï¡£ÆäÖÐÓÐ3Ìõ¼Ç¼·Ö±ð±íʾÓïÎÄ70·Ö£¬Êýѧ80·Ö£¬Ó¢Óï58·Ö£¬ÇëÓÃÒ»ÌõsqlÓï¾ä²éѯ³öÕâÈýÌõ¼Ç¼²¢°´ÒÔÏÂÌõ¼þÏÔʾ³öÀ´£¨²¢Ð´³öÄúµÄ˼·£©£º  
   ´óÓÚ»òµÈÓÚ8


Ïà¹ØÎĵµ£º

½â¾öSQL ServerתACCESS×Ô¶¯±àºÅÎÊÌâ

1.´ò¿ªSQL server enterprise mananger "ÆóÒµ¹ÜÀíÆ÷"
ÔÚÄãÒªµ¼³öµÄ SQLÊý¾Ý¿âÉÏÊó±êÓÒ¼ü²Ëµ¥£ºËùÓÐÈÎÎñ-¡·µ¼³öÊý¾Ý

2.»Ø³öÏÖÒ»¸öµ¼³öÏòµ¼´°¿Ú¡£
Ñ¡Ôñ±»µ¼³öµÄÊý¾ÝÔ´£¬ÎªÄã¸Õ²ÅËùÑ¡ÔñµÄÊý¾Ý¿â£¬Èç¹û·¢ÏÖ²»¶ÔÓ¦×ÔÐÐÐ޸ġ£

3.½øÈëµ¼³öµ½Ä¿±êÊý¾ÝÔ´µÄÑ¡Ôñ£¬ÕâÀïÎÒÃÇҪת³ÉACCESSµÄÊý¾Ý¿â¡£×¢ÒâÑ¡ÔñÊý¾ÝÔ´ÀàÐÍΪ&ld ......

oracle ÓÅ»¯Ö® ÕÒ³öµÍЧÂÊsql Óï¾ä

SELECT EXECUTIONS , DISK_READS, BUFFER_GETS,
¡¡¡¡ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio,
¡¡¡¡ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run,
¡¡¡¡SQL_TEXT
¡¡¡¡from V$SQLAREA
¡¡¡¡WHERE EXECUTIONS>0
¡¡¡¡AND BUFFER_GETS > 0
¡¡¡¡AND (BUFFER_GETS-DISK_READS)/BUFFER_GETS ......

¡¾×ª¡¿ ¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information

¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information
http://space.itpub.net/13129975/viewspace-626245
 
Èç¹ûʹÓÃPL/SQL DeveloperÖÐÑ¡ÔñÒ»¸ö´æ´¢¹ý³Ìdebugµ«ÓÖdebug²»½øÈ¥£¡
½â¾öÕâ¸öÎÊÌâÊǺܼòµ¥µÄ£¬Ö»ÐèÒªÔÚPL/SQL DeveloperÖÐÑ¡ÔñÒªdebugµÄ´æ´¢¹ý³Ì£¬È»ºóµãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ôñ"Add debug information"ºóÔÙÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ