相同物料不同供应商显示时合并总价格
2012-07-13 16:32
375 查看
1.原始数据MAT EXT QUANTITY PEIBI PRICE a x 1 1 10 b z 1 1 10 c F 1 0.3 10 c H 1 0.7 10 d I 1 0.1 10 d J 1 0.1 10 d x 1 0.8 10 2.分区查询后的数据MAT EXT QUANTITY PEIBI PRICE SUMV RANKS CNT a x 1 1 10 1 1 1 b z 1 1 10 1 1 1 c F 1 0.3 10 1 1 2 c H 1 0.7 10 1 2 2 d I 1 0.1 10 1 1 3 d J 1 0.1 10 1 2 3 d x 1 0.8 10 1 3 3 3.对物料MAT相同、供应商EXT不同按匹配、价格、数量求和sumv=图号M供应商1的peibi*price*quantity+图号M供应2的peibi*price*quantity+…… 物料 供应商 配比 数量 价格 sum M1 E1 0.7 1 10 20 M1 E2 0.3 1 10 //这里合并了 M2 E2 1 1 20 20 4.SQLwith a as ( select 'a' mat,'x' ext,1 quantity,1.00 peibi, 10 price from dual union all select 'b' mat,'z' ext,1 quantity,1.00 peibi, 10 price from dual union all select 'c' mat,'H' ext,1 quantity,0.70 peibi, 10 price from dual union all select 'c' mat,'F' ext,1 quantity,0.30 peibi, 10 price from dual union all select 'd' mat,'I' ext,1 quantity,0.10 peibi, 10 price from dual union all select 'd' mat,'J' ext,1 quantity,0.10 peibi, 10 price from dual union all select 'd' mat,'x' ext,1 quantity,0.80 peibi, 10 price from dual ) select mat,ext,quantity,peibi,price, sum(quantity*peibi) over(partition by mat ) sumV, rank() over(partition by mat order by mat,ext) ranks, count(*) over(partition by mat ) cnt from a order by mat,ext What's this?!! |
相关文章推荐
- Material Document 中相同的工厂物料库存地点下显示不同的movement type对应的quantity及SUM
- 百度地图中实现历史轨迹显示为BMap.InfoWindow添加多个不同时间点但相同经纬度点的信息
- 不同gdb,相同数据集合并
- Android把相同图片放到不同的文件夹显示不同的问题
- 合并结构相同,不同,或多个DataTable
- 比较两个DataTable中不同的记录,且合并两个DataTable的列显示,有图
- (转载)SQL 2005 当我们想将某个字段相同的几行数据合并为一列显示的时候 合并列值
- c# 对两个Datatable的结构相同进行合并,结构相同和不同
- (转载)SQL 2005 当我们想将某个字段相同的几行数据合并为一列显示的时候 合并列值
- 如何将不同数组对象合并,根据相同的key
- 合并俩Map相同的key,value相加,不同的key追加
- [C#]字符串比较--显示相同[In VS],比较结果却不同
- 解决Input与Select设置CSS宽度相同时显示宽度不同的解决!
- C语言学习4: 函数返回值与传入参数,关于函数值传递和类型隐性转换,变量不同的作用域,static变量,多文件编译例如两个C文件,显示函数调用语句跳转,递归,斐波那契数列,多文件编译相同变量的问题。
- 浏览器下相同代码在不同页面内显示不同
- 解决qt在相同分辨率不同宽度的屏幕下字体显示位置不一样的问题
- FLTK学习-9-相同窗口不同内容显示切换
- 根据不同分辨率显示相同web页面
- 关于结构相同,数据不同的数据库进行一个表数据合并入另一个数据库中的表
- Ngixn根据手机端与电脑端设备相同地址显示不同页面内容