易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle union

select t.lot_number
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=1 union
select t.lot_number||'x'
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=2
union
select t.lot_number||'y'
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=3
union
select t.lot_number||'z'
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=3
union 去掉重复记录 union all保留重复记录。


相关文档:

Oracle维护常用SQL语句汇总

如何远程判断Oracle数据库的安装平台
select * from v$version;
查看表空间的使用情况
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES ......

Oracle 函数 速查

PL/SQL单行函数和组函数详解
函数是一种有零个或多个参数并且有一个返回值的程序。在SQL中Oracle内建了一系列函数,
这些函数都可被称为SQL或PL/SQL语句,函数主要分为两大类:
单行函数
组函数
本文将讨论如何利用单行函数以及使用规则。
SQL中的单行函数
SQL和PL/SQL中自带很多类型的函数,有字符、数字、日期、转 ......

hibernate根据时间日期来查询oracle数据库

使用模糊查询:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); 
Date startdate = sdf.parse(start_date);
Date enddate = sdf.parse(end_date);
List list = sess.createCriteria(MyTabel.class)
               .add( ......

oracle 找出两表之间非重复数据

select r.rollid as rollid from zh1_rool r where r.date_p >=to_date('2009-11-26 23:59:59','yyyy-mm-dd hh24:mi:ss') and rollid not in
(select t.lot_number as rollid
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_ ......

oracle 找出两表之间重复数据

select * from ( select tb1.rollid from (select r.rollid as rollid from zh1_rool r where r.date_p >=to_date('2009-11-26 23:59:59','yyyy-mm-dd hh24:mi:ss') ) tb1
  where tb1.rowid !=
  (
select max(tb2.rown) from (select t.rowid as rown,t.lot_number as rollid
from inv.mtl_onh ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号