当前位置: 代码迷 >> Sql Server >> sql求积如何破
  详细解决方案

sql求积如何破

热度:25   发布时间:2016-04-24 20:19:15.0
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
  相关解决方案