¼Ç¼һЩsqlÓï¾äoracleµÄ
select d.code,d.name, sum(w.weight) weight,round(avg(w.price),2) price,sum(w.money) money
from weight_info w left outer join t_dict d on w.productcode=d.code left outer join t_balancecode b on w.balancecode=b.balancecode where 1=1 and w.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', 'yyyy-mm-dd hh24:mi:ssxff') group by d.code ,d.name
select to_char(trunc(w.operdate,'mm'),'yyYY'), sum(w.weight),avg(w.price),sum(w.money)
from weight_info w left outer join t_dict d on w.productcode=d.code left outer join t_balancecode b on w.balancecode=b.balancecode
where 1=1 and d.code='100' and w.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', 'yyyy-mm-dd hh24:mi:ssxff') group by d.name,trunc(w.operdate,'mm') ;
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
alter system set nls_length_semantics='BYTE' scope=both
sql>show parameter length
NAME TYPE
------------------------------------ --------------------- ......
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash
Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔ ......
ÔÚ´æ´¢¹ý³Ì»ò´¥·¢Æ÷ÖÐʹÓà Transact-SQL ÓαêµÄµäÐ͹ý³ÌΪ£º
ÉùÃ÷ Transact-SQL ±äÁ¿°üº¬Óα귵»ØµÄÊý¾Ý¡£ÎªÃ¿¸ö½á¹û¼¯ÁÐÉùÃ÷Ò»¸ö±äÁ¿¡£ÉùÃ÷×ã¹»´óµÄ±äÁ¿À´±£´æÁзµ»ØµÄÖµ£¬²¢ÉùÃ÷±äÁ¿µÄÀàÐÍΪ¿É´ÓÁÐÊý¾ÝÀàÐÍÒþʽת»»µÃµ½µÄÊý¾ÝÀàÐÍ¡£
ʹÓà DECLARE CURSOR Óï¾ä½« Transact-SQL ÓαêÓë SELECT Óï¾äÏà¹ØÁª¡£ÁíÍ⣬D ......