SQL - Oracle - how to select securities from table with top change % -
I need some help in completing a query in SQL-Oracle, from this value (prices) to price 2 Trying to select rows or security / selections with maximum or maximum profit. Here's what I already have when I try to use sub queries in selection or where the section fails ... and I can not even use those questions which are hardly cited because the tables Data will increase from time to time in 1000 Secretaries.
Select security, value 1, price 2, ((price 2 - value 1) / value 1) * Percentage from the market by 100 percent , PRICE2 NUMBER (6, 2)); Invest in Market Value ('A', 62, 178); Invest in market prices ('B', 80, 328); INSERT in Market Value ('C', 72, 736); INSERT ('D', 270, 565) in market value; Include in Market Prices ('E', 570, 665); Invest in market values ('F', 400, 1640); Include in Market Prices ('G', 800, 3280); COMMIT;
There are several ways to do this: Here's a way:
Select From (Select Security, Value 1, Price 2, ((Price 2 - Price 1) / Value 1) * Percentage of 100, more than dense_rank () (Order by (price 2 - Price 1 ) / Value 1) * 100 days of market ranking) where ranking = 1;
Comments
Post a Comment