我的思路:
1、从数据库中按物料号和日期筛选出来一定的记录,把记录放入一个新的表中
select
a.item_no, b.note,b.graph_no, a.line_no, a.qty_get,
a.pur_rate_amt, a.act_sum, a.tax_sum, c.supply_code,
a.date_get
from get_detail a,item b,get_head c
where a.get_no = c.get_no
and a.item_no =b.item_no
and a.item_no like '01%'
and to_char(get_detail.date_get,'yyyy-mm-dd')>='2008-07-01'
and to_char(get_detail.date_get,'yyyy-mm-dd')>='2008-07-31';
2、物料号是唯一性,物料号不同,材料则不一样。
删除记录中:同一个物料号只从一个供应商购买的记录
因为价格没有可对比性。
3、对剩下的记录进行分析
同一个物料在不同厂商的购买数量、价格注:item_no :物料号 note:名称 graph_no:规格 line_no:单据号 qey_get:购买数量 pur_rate_amt:暂估价格 act_sum:实际价格
tax_sum:税 supply_code:供应商代码 date_get:到货日期
1、从数据库中按物料号和日期筛选出来一定的记录,把记录放入一个新的表中
select
a.item_no, b.note,b.graph_no, a.line_no, a.qty_get,
a.pur_rate_amt, a.act_sum, a.tax_sum, c.supply_code,
a.date_get
from get_detail a,item b,get_head c
where a.get_no = c.get_no
and a.item_no =b.item_no
and a.item_no like '01%'
and to_char(get_detail.date_get,'yyyy-mm-dd')>='2008-07-01'
and to_char(get_detail.date_get,'yyyy-mm-dd')>='2008-07-31';
2、物料号是唯一性,物料号不同,材料则不一样。
删除记录中:同一个物料号只从一个供应商购买的记录
因为价格没有可对比性。
3、对剩下的记录进行分析
同一个物料在不同厂商的购买数量、价格注:item_no :物料号 note:名称 graph_no:规格 line_no:单据号 qey_get:购买数量 pur_rate_amt:暂估价格 act_sum:实际价格
tax_sum:税 supply_code:供应商代码 date_get:到货日期
where item_no in (
select item_no
from (select distinct item_no,supply_code from 表名 )
group by item_no
having count(supply_code)=1)