|
建议楼主在论坛搜索“简易的数据管理”。以下供参考。
把各表的第一行删除
- select * from (select *,金额/(select sum(金额) from (select * from [8月$] union all
- select * from [9月$] union all
- select * from [10月$] union all
- select * from [11月$] union all
- select * from [12月$])) as 比例 from (select * from [8月$] union all
- select * from [9月$] union all
- select * from [10月$] union all
- select * from [11月$] union all
- select * from [12月$]))a,(select 客户,sum(比例) as 总比 from (select *,金额/(select sum(金额) from (select * from [8月$] union all
- select * from [9月$] union all
- select * from [10月$] union all
- select * from [11月$] union all
- select * from [12月$])) as 比例 from (select * from [8月$] union all
- select * from [9月$] union all
- select * from [10月$] union all
- select * from [11月$] union all
- select * from [12月$])) group by 客户)b where a.客户=b.客户 and b.总比>=0.08
复制代码 |
|