E
eloveme
Unregistered / Unconfirmed
GUEST, unregistred user!
用到PUBS中的2个数据表(sales,stores)
我现在想得到下面这中结果
stor_id sum(qty) qty2 qty3 qty4 。。
有多少QTY就有多少QTYN
Eric the Read Books 8 5 3 0 0 ..
Barnum's 125 50 70
News & Brews 90 10 40 20 20
Doc-U-Mat: Quality Laundry and Books 130 20 25 20 25 40
也就是说sum(qty) = qty2 + qty3 +...+qtyn ,qtyn是以qty分项最多的为准,没有的用0代替 ,可以不用存储过程搞定吗?请大家多多指教。
我现在想得到下面这中结果
stor_id sum(qty) qty2 qty3 qty4 。。
有多少QTY就有多少QTYN
Eric the Read Books 8 5 3 0 0 ..
Barnum's 125 50 70
News & Brews 90 10 40 20 20
Doc-U-Mat: Quality Laundry and Books 130 20 25 20 25 40
也就是说sum(qty) = qty2 + qty3 +...+qtyn ,qtyn是以qty分项最多的为准,没有的用0代替 ,可以不用存储过程搞定吗?请大家多多指教。