sql server - How to reach maximum of product -
I'm new to Esquilla and I'm trying to write a query that multiply with maximum two separate columns Takes it. / P>
A table is called a portfolio and the amount of shares purchased is done. The other table is called investment and the price is paid. After multiplying the two values, I am trying to get the highest (maximum) purchase price. Any help would be appreciated.
Assuming that you are the maximum you want, and that the price is stored in the investment table ' Quantity 'column and the number of shares purchased is the' amount 'column on the portfolio table, and that the link between portfolio and investment tables is' port_id' You want something like this:
SELECT MAX (t2.mount * t1.quantity) AS 'Maximum Purchase Price' Investment T1 JOIN Portfolio T2 ON t1.port_id = t2.port_id
If you have more The need then you can add them in the SELECT list and you Group will add by (lots of posts related to this). Hope it helps!
Comments
Post a Comment