SQL °´ÖÜ,ÔÂ,¼¾¶È,Äê²éѯͳ¼ÆÊý¾Ý
//°´×ÔÈ»ÖÜͳ¼Æ
select to_char(date,'iw'),sum()
from
where
group by to_char(date,'iw')
//°´×ÔÈ»ÔÂͳ¼Æ
select to_char(date,'mm'),sum()
from
where
group by to_char(date,'mm')
//°´¼¾Í³¼Æ
select to_char(date,'q'),sum()
from
where
group by to_char(date,'q')
//°´Äêͳ¼Æ
select to_char(date,'yyyy'),sum()
from
where
group by to_char(date,'yyyy')
Ïà¹ØÎĵµ£º
SQL Server Out Put Excel File
ÔÚ SQL ServerÖÐ, µ¼³öEXCEL Îļþ, Óõ½ bcp.exe
bcp µ¼³öµÄ±¾ÖÊÊÇ´¿Îı¾Îĵµ,
ÈôÊý¾Ýº¬ÓÐÖÐÎÄ,Çëµ¼³öµ½ÖÐÎİæEXCEL,»òTXTÎĵµµÈ, ·ñÔòÂÒÂë....
ÓÃTXT ´ò¿ªÓ¢ÎİæEXCEL,Ò²¿ÉÒÔ,
µ¼³ö Êý¾Ýµ½C:\authors.xls, ÈôÎļþ´æÔÚÔòÖØÐ´Îļþ, ²»´æÔÚÔò´´½¨Îļþ
  ......
ÈçºÎÔ¶³ÌÅжÏOracleÊý¾Ý¿âµÄ°²×°Æ½Ì¨
¡¡¡¡select * from v$version;
¡¡¡¡²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
¡¡¡¡select sum(bytes)/(1024*1024) as free_space,tablespace_name
¡¡¡¡from dba_free_space
¡¡¡¡group by tablespace_name;
¡¡¡¡SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES ......
Ò»¡¢ ¾µÏñ¼ò½é
1¡¢ ¼ò½é
Êý¾Ý¿â¾µÏñÊǽ«Êý¾Ý¿âÊÂÎñ´¦Àí´ÓÒ»¸öSQL ServerÊý¾Ý¿âÒÆ¶¯µ½²»Í¬SQL Server»·¾³ÖеÄÁíÒ»¸öSQL ServerÊý¾Ý¿âÖС£¾µÏñ²»ÄÜÖ±½Ó·ÃÎÊ;ËüÖ»ÓÃÔÚ´íÎó»Ö¸´µÄÇé¿öϲſÉÒÔ±»·ÃÎÊ¡£
Òª½øÐÐÊý¾Ý¿â¾µÏñËùÐèµÄ×îСÐèÇó°üÀ¨ÁËÁ½¸ö²»Í¬µÄSQL ServerÔËÐл·¾³¡£Ö÷·þÎñÆ÷±»³ÆÎª“Ö÷»ú”£¬µÚ¶þ¸ö·þÎñÆ÷±» ......
order by
ÅÅÐòͨ¹ýorder by×Ó¾äʵÏÖ£¬order byÔÚSELECTÓï¾äµÄ×îºó¡£
Óï·¨£º
order by field1 [ASC|DESC][,field2 [ASC|DESC],..,fieldn [ASC|DESC]]
ASC£ºÉýÐò
DESC£º½µÐò
ĬÈÏΪÉýÐò
¿ÕÖµ×÷ΪÎÞÇî´óÀ´´¦Àí¡£
ÁíÍâ¿ÉÒÔ°´ÕÕ²éѯÁбíÖÐÐòºÅ½øÐÐÅÅÐò¡£
ϵͳÔÚÓû§Ð´³ö²éѯÁбíµÄͬʱ¾Í¸³Óèÿ¸öÁÐÃûÒ»¸ ......
--> Title : SQL ServerÊÓͼÖг£見ÏÞÖÆÌõ¼þ
--> Author : wufeng4552
--> Date : 2010-03-01
(1): ÊÓͼÊý¾Ý¸ü¸ÄµÄ³£見ÏÞ¶¨
µ±Óû§¸üÐÂÊÓͼÖеÄÊý¾Ýʱ,Æäʵ¸ü¸ÄµÄÊÇÆä¶ÔÓ¦µÄÊý¾Ý±íµÄÊý¾Ý.ÎÞÂÛÊǶÔÊÓͼÖеÄÊý¾Ý½øÐиü¸Ä,»¹ÊÇÔÚÊÓͼÖвåÈë»òÕßɾ³ýÊý¾Ý,¶¼ÊÇÀàËÆµÄµÀÀí.µ«ÊÇ,² ......