添加列值并在另一列中显示 [英] Adding Column Values and displaying in another column

查看:81
本文介绍了添加列值并在另一列中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,这是我的问题.

我正在存储过程中进行一些计算并显示如下...我想添加Basic,BasicDuty,CVD,Custom,AddDuty并将其显示为ActualCost

产品名称产品代码基本BasicDuty CVD自定义AddDuty ActualCost

生产者1 P1 4553 34 32 143 11 4553 + 34 + 32 + 143 + 11

我该怎么办..帮帮我

这是实际的过程

Hi everyone,here is my issue.

I am doing some calculations in stored procedure and display as below ...I want to add Basic,BasicDuty,CVD,Custom,AddDuty and display it as ActualCost

ProductName ProductCode Basic BasicDuty CVD Custom AddDuty ActualCost

Produc1 P1 4553 34 32 143 11 4553+34+32+143+11

How can i do this..help me out

Here''s the actual proc

select ProductName,ChapterCode,ISNULL(@Dollarrate,0)*ISNULL(@INR,0) BASIC,
    ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) CustomINR,
    (ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)) * DBO.DIVIDE(PM.LCost,100) LCOST,
    (((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100)) BASICDUTY,
     ((((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)) * DBO.DIVIDE(PM.LCost,100)+ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0))*DBO.DIVIDE(PM.CVD,100) CVD,
     ((((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+((((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+
     (ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)) * DBO.DIVIDE(PM.LCost,100)+ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0))*DBO.DIVIDE(PM.CVD,100))*DBO.DIVIDE(PM.Custom,100) Custom,
     (ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)) * DBO.DIVIDE(PM.LCost,100)+(((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+((((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+
(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)) * DBO.DIVIDE(PM.LCost,100)+ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0))*DBO.DIVIDE(PM.CVD,100)+((((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+
((((ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0) * DBO.DIVIDE(PM.LCost,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)))*DBO.DIVIDE(PM.BASIC,100))+(ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0)) * DBO.DIVIDE(PM.LCost,100)+ISNULL(@Dollarrate,0)*ISNULL(@CustomINR,0))*DBO.DIVIDE(PM.CVD,100))*DBO.DIVIDE(PM.Custom,100))*DBO.DIVIDE(PM.SAD,100) ADDDUTY
    FROM ProductMaster PM WITH(NOLOCK)  where Productname=@ProductName

推荐答案

您现在存储的过程是什么?

从TableName
中选择productname,productcode,basic,basicduty,cvd,custom,addduty,(productname + productcode + basic + basicduty + cvd + custom + addduty)作为ActualCost
似乎是显而易见的解决方案
What is your stored proc now ?

Select productname, productcode, basic, basicduty, cvd, custom, addduty, ( productname + productcode + basic + basicduty + cvd + custom + addduty) as ActualCost from TableName

seems the obvious solution


这篇关于添加列值并在另一列中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆