补充
销售额是num*price(编号一样price一样)
每个表中都有自己的num和price
如select 编号 as 编号,sum(sum(北美.num*北美.price)+sum(日本.num*日本.price)+sum(欧洲.num*欧洲.price)) as 销售额 where (北美.编号=日本.编号=欧洲.编号) and (在一段时间段内) group by 编号
但我没做出来
请高手帮忙!谢谢!
销售额是num*price(编号一样price一样)
每个表中都有自己的num和price
如select 编号 as 编号,sum(sum(北美.num*北美.price)+sum(日本.num*日本.price)+sum(欧洲.num*欧洲.price)) as 销售额 where (北美.编号=日本.编号=欧洲.编号) and (在一段时间段内) group by 编号
但我没做出来
请高手帮忙!谢谢!
Create view a1
as
select 编号,num,price From 北美
union all
select 编号,num,price From 日本
union all
select 编号,num,price From 欧洲
;
再Select 编号,sum(num*price) From a1 group by 编号;好象用一个SQL语句来关联,写出来的可能性不大;
(select '北美' area,quantity from northamericantable
union all
select '日本' area,quantity from japantable
union all
select '欧洲' area,quantity from europetable) a
真的
mycode的方法可以
但guo的更简单
我一试之下竟然可以出来了
真的非常感谢
我试了N遍呀
真想请两位吃饭
我的email是[email protected]