MySQL Forums
Forum List  »  InnoDB

Retrieving query
Posted by: Larry Regencia
Date: July 04, 2005 09:56PM

hello guys,

i would like to ask again about your expertise with regards to sql queries. i belive this is pretty easy but the results i have are not the ones I wanted. Here's the scenario:

Table A
id stockcode runningbalance
1 A1 100.00
2 A2 100.00
3 A1 50.00
4 A3 200.00
5 A2 150.00
6 A4 350.00
7 A5 250.00
8 A1 150.00


Results that I wanted should be:

id stockcode runningbalance
8 A1 150.00
5 A2 150.00
4 A3 200.00
6 A4 350.00
7 A5 250.00

The results I need is to retrieve the last data, group by stockcode. I have tried several queries already and I was able to retrieve the id and stockcode but the runningbalance was not the latest, it was the runningbalance of the first record.
Any idea would very much appreciated. Thanks a lot.



Larry Vincent

Options: ReplyQuote


Subject
Views
Written By
Posted
Retrieving query
2872
July 04, 2005 09:56PM
1672
July 04, 2005 11:50PM
1899
July 05, 2005 12:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.