Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Calculated Columns within SQL Stored Procedure

$
0
0

Hi All

I need to write a stored procedure in SQL that selects data from 2 tables into 1 table, the resulting table will get 3 new calculated columns , so the stored proc must select the data from the 2 tables  and at the same time add 3 new columns as calculated fields. There is a trick part in the calculation as an example , the script should do something like this:
IF 'item charges'=0, then sales amount
IF 'item charges' = 'Promo' or 'rebate' or 'Storage' then sales amount.

the 3 new calculated column names will be Gross Revenue , Export Cost and Sales Support

hope anyone can assist

thanks


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>