Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » Database Programming » SQL Help


SQL HelpExpand / Collapse
Author
Message
Posted 5/30/2007 9:08:39 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Post #22013
Posted 6/15/2007 12:13:43 AM


Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum 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!
Post #22138
Posted 6/15/2007 12:20:59 AM


Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum 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!
Post #22139
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:41am