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

ÇÉÓÃSQLÖеÄWITH£¨Ê÷ÐͽṹÊý¾ÝµÄ²éѯ£©

Èç¹û±íÖдæ·ÅµÄÊý¾ÝÊÇÊ÷Ðνṹ£¬µ±ÖªµÀijһ¸ö½ÚµãµÄֵʱ£¬Í¬Ê±ÏëÈ¡µÃËüËùÓÐ×Ó½ÚµãµÄÊý¾Ý¡£
±í½á¹¹£º
        
         
 ±íÖдæ·ÅµÄÊDz¿ÃÅ×éÖ¯½á¹¹£¬ BMN_CD²¿ÃÅ£¬SSK_KAISO_LVÊǽײ㣬BMN_MKJ²¿ÃÅÃû³Æ£¬JOI_KAISO_LVÉÏλ½×²ã£¬JOI_BMN_CDÉÏλ²¿ÃÅ¡£
¼ìË÷SQL :
 
    WITH Moduals (BMN_CD, SSK_KAISO_LV, BMN_MKJ, BMN_NM_RYKS, SKI_FLG, JOI_KAISO_LV, JOI_BMN_CD) AS (SELECT
    T130A.BMN_CD,
    T130A.SSK_KAISO_LV,
    T130A.BMN_MKJ,
    TRIM(T130A.BMN_NM_RYKS) BMN_NM_RYKS,
    T130A.SKI_FLG,
    T130A.JOI_KAISO_LV,
    T130A.JOI_BMN_CD
from
    T130 T130A
WHERE
    T130A.BMN_CD = 'B00011' AND
UNION ALL
SELECT
    T130B.BMN_CD,
    T130B.SSK_KAISO_LV,
    T130B.BMN_MKJ,
    TRIM(T130B.BMN_NM_RYKS) BMN_NM_RYKS,
    T130B.SKI_FLG,
    T130B.JOI_KAISO_LV,
    T130B.JOI_BMN_CD
from
    T130 T130B
INNER JOIN Moduals T130C
   ON T130B.JOI_KAISO_LV = T130C.SSK_KAISO_LV
  AND T130B.JOI_BMN_CD = T130C.BMN_CD
)
SELECT Moduals.BMN_CD,SSK_KAISO_LV, BMN_MKJ, BMN_NM_RYKS, SKI_FLG, JOI_KAISO_LV, JOI_BMN_CD from Moduals
¡¾ WHERE ………… ¡¿
Èç¹û¶Ô¼ìË÷½á¹û»¹ÓÐÏÞÖƵĻ°£¬¿ÉÒÔ¼ÓWHEREÓï¾ä½øÐÐÏÞÖÆ¡£¡£¡£¡£¡£¡£¡£¡£
¼ìË÷½á¹û£º
         


Ïà¹ØÎĵµ£º

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

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

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

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

oraleÖÐsqlÓï¾ä¶ÔnullÖµµÄ´¦Àí

µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃNVLº¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL(exp1,exp2)¡£ÆäÖвÎÊýexp1ºÍexp2¿ÉÒÔʹÈÎÒâÊý¾ÝµÄÀàÐÍ£¬µ«Á½ÕßÊý¾ÝÀàÐͱØÐëÆ¥Å䡣ʾÀý£ºselect ename,sal,comm,sal+nvl(comm,0) as salary from emp;
µÚ¶þÖÖ·½·¨£ºÊ¹ÓÃNVL2º¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL2(exp1,exp2,exp3)¡£ÕâÊÇoracle9iÐÂÔö¼ÓµÄº¯Êý¡£Èç¹ûexp1 ......

¸ß¼¶ SQL 1

1 µ±Ê¹ÓÃgroup byʱ£¬Î´ÔÚgroup by ²¿·ÖÓõ½µÄ±íÁÐÔÚs e l e c t²¿·Ö³öÏÖʱ±ØÐëʹÓ÷Ö×麯Êý¡£
select last_name, state_cd, sum(sales) from customer group by last_name;
ERROR at line 1:
ORA-00979: not a GROUP BY expression.
state_cdÓ¦¸ÃʹÓ÷Ö×麯Êý£¬m a x ( )¡¢m i n ( )¡¢s u m ( )¡¢c o u n t ( )»òa v g ......

PL/SQL ѧϰ


1¡¢INSTR4(string1,string2[,a][,b]) ·µ»Østring1Öаüº¬string2µÄλÖÃaºÍbÊÇÒÔUCS4´úÂëµãΪµ¥Î»¡£
ÒÔÉϺ¯Êý·µ»Østring1Öаüº¬string2µÄλÖᣴÓ×ó±ß¿ªÊ¼É¨Ãèstring1,ÆðʼλÖÃÊÇA¡£Èç¹ûAΪ¸ºÊýÄÇô´ÓÓұ߿ªÊ¼É¨Ãè¡£µÚB´Î³öÏÖµÄλÖý«±»·µ»Ø¡£AºÍBȱʡ¶¼Îª1£¬¼´·µ»ØÔÚ
string1ÖеÚÒ»´Î³öÏÖstring2µÄλÖá£Èç¹ûstring2ÔÚAº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ