程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> Oracle cookie remark

Oracle cookie remark

編輯:Oracle數據庫基礎

//利用decode實現枚舉值到枚舉名稱的一個轉換:
select count(t.id) as amount,
       decode(t.CAPITAL_TYPE,
              1,
              ''有帳設備'',
              2,
              ''買斷設備'',
              3,
              ''帳消庫存'',
              4,
              ''淨值為零'') as name
  from Mach_Basic_Info t
 where t.Mach_state in (1, 2)
 group by t.CAPITAL_TYPE
 order by amount desc
//對具有id-parent_id結構的字典表進行一個第一級別的關聯匯總:
select t1.parent_id, t1.amount, t2.type_name
  from (select d.parent_id, count(t.id) as amount
          from Mach_Basic_Info t, Mach_Type_dict d
         where t.Mach_type_id = d.id
           and t.Mach_state in (1, 2)
         group by d.parent_id) t1,
       Mach_Type_dict t2
 where t1.parent_id = t2.id
 order by amount desc
//對具有id-parent_id,inner_code(內部層次編碼,開發可見),outer_code(外部用戶編碼,用戶可見)結構的字典表進行一個關聯查詢:
 select *
   From (select m.MANAGE_DEPT_ID,
                t.inner_code,
                m.original_value,
                m.Net_value
           from mach_basic_info m, Mach_type_dict t
          Where m.Mach_state in (1,

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved