Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Need help with an SQL calculation

$
0
0

Build the statement step by step:

a: What table will this information come from? Products (FROM clause) which I got

b: What fields have been requested:  Product Name, Unit Price, Units in Stock, and the total value of the items in stock. (SELECT clause) - I have all of this except the total value part

c. Where will the total value come from?  It is not in the table.  This will be a calculated field.  The total dollar value will be the result of multiplying unit price by units in stock. (confused on this)

d. Give the calculated field column a name (known as an alias) - confused on this

e: In what order will the results be listed?  The ORDER BY clause can use a field name or the fields position in the SELECT clause.

SELECT ProductName, UnitPrice, UnitsInStock, Total Value
FROM Products
WHERE UnitPrice * UnitsInStock = Total Value

This is what I have but it's not coming out right.  Please help!


Viewing all articles
Browse latest Browse all 14337

Trending Articles



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