日期:2014-05-17  浏览次数:20503 次

sql求积怎么破?
select  product_count, product_price from [order] where [user_id]=4078



表里有N行,每行有2列  数量(product_count)、价格(product_price)每行小计怎么求积,


数量、价格 小计
3 12.80 ?
8 13.90 ?
4 13.90 ?
6 13.90 ?
2 10.90 ?
5 9.80 ?
sql select

------解决方案--------------------


select  product_count, product_price ,

(product_count * product_price) as money

from [order] where [user_id]=4078




------解决方案--------------------

select product_count,
       product_price,
       (product_count*product_price) '小计'
 from [order] 
 where [user_id]=4078

------解决方案--------------------

select  product_count, product_price,product_count*product_price '小计' from [order] 

------解决方案--------------------
select  product_count as 数量, 
        product_price as 价格,
        product_count * product_price as 小计
from [order] 
where [user_id]=4078