0

Hi,

I'm using this SQL statement to retrieve Value and Date which will then be plotted on a graph:

SELECT DISTINCT assets.SEDOL,assets.Quantity,stock_names.value,stock_names.Fileid,date_header.dateid 
FROM assets,stock_names,date_header 
WHERE assets.Client_ref = '$clientref' AND stock_names.SEDOL = assets.SEDOL 
AND date_header.fileid = stock_names.fileid

I'm also selecting Quantity. Instead of having to multiply out the arrays, how can I multiply value and quantity inside the SQL statement and then just return Value (multiplied by quantity)?

3
Contributors
2
Replies
19
Views
4 Years
Discussion Span
Last Post by AleMonteiro
0

Use assets.Quantity * stock_names.value as Price .IN SELECT QUERY.you can use simple arithmetic operators on two number.

SELECT DISTINCT assets.SEDOL,assets.Quantity,stock_names.value,stock_names.Fileid,date_header.dateid ,assets.Quantity*stock_names.value as Price
FROM assets,stock_names,date_header 
WHERE assets.Client_ref = '$clientref' AND stock_names.SEDOL = assets.SEDOL 
AND date_header.fileid = stock_names.fileid

Edited by IIM

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.