我有名为“购物车”的表。字段是:如何做添加在Sql Server中使用动态生成字段?
CartId
ClientId
ProductId
Qty
现在我加入这个表ProductMaster
得到ProductName
和ProuctPrice
select cc.CartId,cc.ProductId,pm.ProductName,cc.Qty,
(pm.ProductPrice * cc.Qty) As SubTotal
from ClientCart as cc
inner join ProductMaster as pm on cc.ProductId = pm.ProductId
现在我想生成GrandTotal
使用动态字段SubTotal
。我怎样才能做到这一点?
去掉无关的MySQL标签 – Jens
添加一些示例表数据和预期的结果。 (作为格式文本。) – jarlh