
sql
butterluo
这个作者很懒,什么都没留下…
展开
-
sql---example of the using of "case when"
/*tested in oracle*/ /* you can use select statment in then clause*/ SELECT CASE bh.zajlx WHEN '2' THEN (SELECT qt1.sfdb FROM t03_qtajxx qt1 ...2007-12-20 13:40:55 · 125 阅读 · 0 评论 -
日期的操作包含在子查询中
/*日期的操作包含在子查询中,oracle测试通过*/ SELECT count(*), c.lrr_dm FROM jc_ajxx c WHERE c.jczt_dm IN ('01', '02', '10') and c.ajbh in (select c...2007-12-20 13:43:27 · 261 阅读 · 0 评论 -
exists 的应用
[code] SELECT cq.ayxsbh, cq.process_ins_id, nsr.nsrsbh, nsr.nsrmc, jg.swjg_mc FROM t03_cqzb cq, t03_ayxsqc ay, dm_swjg jg, dj_nsrxx nsr WHERE cq.process_ins_id = 2991 AND SYSDATE > cq.jzrq ...2007-12-20 20:54:52 · 119 阅读 · 0 评论 -
子查询的应用
[code] /* Formatted on 2007/12/20 18:12 (Formatter Plus v4.8.8) */ SELECT * FROM (SELECT w.workitem_id, w.m_id, w.process_def_id, w.process_def_...2007-12-20 20:57:49 · 152 阅读 · 0 评论 -
用于oracle的一种sql分页方法
[code] SELECT * FROM (SELECT a.*, ROWNUM row_num FROM (SELECT t1.ajbh, t1.lrajbh, t2.nsrsbh, t2.nsrmc, t4.swjg_mc, t5.jczt_mc, CASE...2007-12-21 19:27:03 · 119 阅读 · 0 评论 -
union一例,oracle上的union会自动把重复的列去掉
[code] --当该人是选案人员时 select qt.ajbh, qt.lrajbh, nsr.nsrsbh, nsr.nsrmc, jg.swjg_mc, zt.jczt_mc, qt.sfla from ctais2wg.t03_qtajxx qt ,ctais2wg.t03_ayxsqc ay ,ctais2wg.dm_jczt zt ,ctai...2007-12-23 18:12:31 · 1458 阅读 · 0 评论