2
回答
【菜鸟】提问有关Oracle query
终于搞明白,存储TCO原来是这样算的>>>   
SELECT (CASE
             WHEN TBC.USE_YN = 'O' THEN ''
             WHEN TBCU.USE_YN = 'Y' THEN ''
             WHEN TBCU.USE_YN = 'N' THEN 'style=\"display: none;\"'
             ELSE 'style=\"display: none;\"'
          END)
            COL_SH,
         SUM (
            CASE
               WHEN TBC.USE_YN = 'O' THEN 1
               WHEN TBCU.USE_YN = 'Y' THEN 1
               WHEN TBCU.USE_YN = 'N' THEN 0
               ELSE 0
            END)
         OVER () COL_CNT
    FROM T_BANN_COL TBC,
         (SELECT COL_NUM, USE_YN
            FROM T_BANN_COL_USE
           WHERE USE_YN = 'Y' AND IN_NUM = ".$_SESSION['A_NUM'].") TBCU
   WHERE TBC.COL_NUM = TBCU.COL_NUM(+) AND TBC.USE_YN <> 'N'
ORDER BY ORDERBY;

其中,
over() col_cnt 什么意思?网上说: 它是为改善grup by , order by 语句而诞生的函数。

WHERE TBC.COL_NUM = TBCU.COL_NUM(+) AND TBC.USE_YN <> 'N'
这里的(+) <> ‘N'又是干什么的?



举报
luxury515
发帖于2年前 2回/66阅
顶部