| | | Forum Newbie
       
Group: Forum Members Last Login: 9/30/2007 9:20:55 AM Posts: 7, Visits: 24 |
| First Look at the stucture of the table below:
InvoieNo CustomerCode CustomerName Balance
1 7 Ali 400
2 7 Ali 300
3 7 Ali 500
1 4 Bilal 400
2 4 Bilal 500
Now i want to pick the latest balance of each customer so the output should be:
InvoieNo CustomerCode CustomerName Balance
3 7 Ali 500
2 4 Bilal 500
what will the query for this please help thanks in advace. 
AliAmjad |
| | | | 
Forum Guru
       
Group: Forum Members Last Login: 10/31/2008 7:29:47 AM Posts: 101, Visits: 310 |
| your problem is difficult but maybe i can suggest you another way to view the latest balance of the customer.
1. make a table where you can put all the transactions like the paying of the customers where u can see there records. ("and maybe thats the table you made in the example")
2. On the table where the customer profile stored put another field which is of course for their balance.
... so therefor if you want to view the balances of the customers you should go to the table of customer profile.
... if you want to update their record then you just simply edit it.
hope my idea can help you.
I'll just try! |
| | | | 
Forum Guru
       
Group: Forum Members Last Login: 10/31/2008 7:29:47 AM Posts: 101, Visits: 310 |
| sample table:
[b]Customer_Table
Customer_Code Customer_Name Balance[/b]
000143 jireh 1000
000421 Ali 800
Customer_Payments_Table
Invoice_Number Customer_Code Amount Date
2423423 000143 500 5/15/2007
5645645 000143 300 6/13/2007
3435355 Ali 400 5/25/2007
...On this you can still view their payments
I'll just try! |
| |
|
|