Tough SQL problem for an amateur like me

Amitava

New Member
My family has several stock accounts, and I keep a table of stock values for their contents and enter current values daily. Fields are... \[code\] ACCOUNT / TICKER / QUANTITY / CLOSINGDATE/ CLOSING (current price)\[/code\]To get a report of the current stock contents and most recent price, I am using this code. I add this up row by row, and get an account total (for account # 2, for example ). The table is designed this way also so I can track individual stock performance.\[code\]SELECT distinct ticker, account, closingdate, quantity, closing, (quantity*closing) as "Net"FROM "stock values" AS SWHERE(account=2) and(quantity>0.000001) and(closingdate =(SELECT MAX(closingdate) FROM "stock values" WHERE ( ticker = S.ticker) and (account=s.account)) )\[/code\]But now what I would like to do is create a report that looks like this on a TdbGrid so that... i get a report, grouped by account with the most recent distinct tickers added up FOR THAT ACCOUNT. Four days later, I cannot crack this.\[code\]Account Value 1 35,000.00 2 122,132,32 3 43.23\[/code\]I'm using Nexus 3 on Delphi 7.Any help, greatly GREATLY appreciated.Larry
 
Top