I’m trying to find out how to show the total value in a table (item*quantity) of all the items in one line. The code below shows the total of every single item on one line each, not the total value of all of them. How can this be done?
I guess I should use a subquery, but not how to design it.
Thanks in advance
SELECT CONVERT(Decimal(8,0),ROUND((quantity*price),2)) AS Total
FROM Item
EDIT: By mistage I included ITEMNAME, that shall NOT be a part of the result!
The table is designed as follows:
ITEMNAME QUANTITY PRICE
Table 20 100
Chair 30 50
and so on
The result is as follows:
ITEMNAME TOTAL
Table 2000
Chair 1500
I want it this way:
TOTAL
3500
1 Answer