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保留重复记录。
相关文档:
ceil(number) 大于或等于的最小整数
floor(number) 小于或等于的最大整数
trunc(number,m) 在整数number的m位置截掉m及以后的位数:
如:trunc(15.78,1)=15.7
trunc(15.78,-1)=15;
round ......
按资料说V$BH查看表来显示数据库里每个对象类型的数据缓冲区里数据块的数量.
然后查询V$bh
select
owner, object_name
from
dba_objects o,
v$bh &nbs ......
1.概述
索引是应用设计和开发的一个重要方面。如果有太多的索引,DML 的性能就会受到影响。如果索引太
少,又会影响查询(包括插入、更新和删除)的性能。要找到一个合适的平衡点,这对于应用的性能至关
重要。
我常常发现,人们在应用开发中总是事后才想起索引。我坚持认为这是一种错误的做法。如果你知
道数据将如何 ......
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 ......