DataStructors23
DataStructors23

Reputation: 137

SQL, multiply two columns in the same row and create a "total" column

enter image description here

That is what I am trying to achieve, I have everything except for the Total column. The total column be the result of the Number * Product Price. I have tried several sum() queries, but none are coming out the way I want and finding it difficult making this new column in the process. Any help would be appreciated, thanks.

Upvotes: 2

Views: 8148

Answers (1)

Jonathan Porter
Jonathan Porter

Reputation: 1556

You should be able to simply append it to your query like so:

SELECT TransactionID,
       CustomerID,
       StoreID,
       TransactionDate,
       Number,
       ProductName,
       ProductPrice,
       Number*ProductPrice AS Total
FROM dbo.table

Upvotes: 4

Related Questions