select sum(sfv09) from sfv_file,sfu_file where sfu01=sfv01 and sfv04 like '23%' and sfu02<=to_date('2015/03/31','YYYY/mm/dd') and sfu02>=to_date('2015/03/01','YYYY/mm/dd') --料件月入库总数
select * from sfv_file where sfvud13>=to_date('2015-05-01','yyyy/mm/dd') and sfvud13<=to_date('2015-05-31','yyyy/mm/dd') --恒宇入库
select * from oga_file
select oga02,ogb04,ogb092,ogb12,oga03 from ogb_file,oga_file where
oga02>=to_date('2015-05-01','yyyy/mm/dd') and oga02<=to_date('2015-05-31','yyyy/mm/dd') and oga01=ogb01 --恒宇出货
select img01,ima02,img02,img04,img10,obg21,(obg21*img10) from img_file,obg_file,ima_file where
img10>0 and obg02=img01 and img02='A101' and ima01=img01 and obgdate=(select max(obgdate) from obg_file where obg02=img01)
order by (obg21*img10) desc
select img01,ima02,img02,img04,img10,c.obg21,(c.obg21*img10) from img_file,ima_file,
(select a.obg02,a.obg21 from obg_file a
where a.obgdate = (select max(b.obgdate) from obg_file b where a.obg02 = b.obg02)) c
where img01=ima01 and img02='A101' and img10>0
and img01=c.obg02
order by (c.obg21*img10) desc
create table ecb_bak as select * from ecb_file p where ecb01 like '25%'
and exists(select 1 from (select ecb01,ecb02,max(ecb03) as ecb03 from ecb_file where ecb01 like '25%' group by ecb01,ecb02)q
where p.ecb01=q.ecb01 and p.ecb02=q.ecb02 and p.ecb03=q.ecb03) --建立新表,源自所有25料件中ecb03中最大值的选项
select * from ecb_bak;
select * from ecb_file where ecb06='B412'
update ecb_bak set ecb17='检验' --更新ECB17
create table ecb_bak20151027 as select * from ecb_file; --备份数据库
insert into ecb_file select * from ecb_bak; --将ecb_bak插入ecb_file;也可以使用merge into
select * from oga_file
select oga02,ogb04,ogb092,ogb12,oga03 from ogb_file,oga_file where
oga02>=to_date('2015-05-01','yyyy/mm/dd') and oga02<=to_date('2015-05-31','yyyy/mm/dd') and oga01=ogb01 --恒宇出货
img10>0 and obg02=img01 and img02='A101' and ima01=img01 and obgdate=(select max(obgdate) from obg_file where obg02=img01)
order by (obg21*img10) desc
select img01,ima02,img02,img04,img10,c.obg21,(c.obg21*img10) from img_file,ima_file,
(select a.obg02,a.obg21 from obg_file a
where a.obgdate = (select max(b.obgdate) from obg_file b where a.obg02 = b.obg02)) c
where img01=ima01 and img02='A101' and img10>0
and img01=c.obg02
order by (c.obg21*img10) desc
and exists(select 1 from (select ecb01,ecb02,max(ecb03) as ecb03 from ecb_file where ecb01 like '25%' group by ecb01,ecb02)q
where p.ecb01=q.ecb01 and p.ecb02=q.ecb02 and p.ecb03=q.ecb03) --建立新表,源自所有25料件中ecb03中最大值的选项
select * from ecb_bak;
select * from ecb_file where ecb06='B412'
update ecb_bak set ecb17='检验' --更新ECB17
create table ecb_bak20151027 as select * from ecb_file; --备份数据库
insert into ecb_file select * from ecb_bak; --将ecb_bak插入ecb_file;也可以使用merge into