Hi all, could someone help me create a procedure to accomplish the following please..
Lets say I have 5 job records in my tblJobs
JobNo, CustomerCode, Price, Status, InvoiceNo,
1, A000, £100.00, Completed, NULL
2, A000, £100.00, Completed, NULL
3, A000, £200.00, Completed, NULL
4, B000, £50.00, Completed, NULL
5, B000, £50.00, Completed, NULL
I need a statement which inserts one new record in my tblInvoices for each different customer in the tblJobs...
Using the above jobs as an example, the following records would be inserted into my tblInvoices.
InvoiceNo, CustomerCode, TotalPrice
1, A000, £500.00
2, B000, £100.00
After inserting these records, it would then update the Status and InvoiceNo fields in the tblJobs so they look like this..
JobNo, CustomerCode, Price, Status, InvoiceNo,
1, A000, £100.00, Invoiced, 1
2, A000, £100.00, Invoiced, 1
3, A000, £200.00, Invoiced, 1
4, B000, £50.00, Invoiced, 2
5, B000, £50.00, Invoiced, 2
Any help would be greatly appreciated. If i knew where to start I would have a go and come back with the problems but I don't even know where to start!
Cheers
John
.NET 2.0, Visual Studio 2005, SQL Server 2005 Express
Lets say I have 5 job records in my tblJobs
JobNo, CustomerCode, Price, Status, InvoiceNo,
1, A000, £100.00, Completed, NULL
2, A000, £100.00, Completed, NULL
3, A000, £200.00, Completed, NULL
4, B000, £50.00, Completed, NULL
5, B000, £50.00, Completed, NULL
I need a statement which inserts one new record in my tblInvoices for each different customer in the tblJobs...
Using the above jobs as an example, the following records would be inserted into my tblInvoices.
InvoiceNo, CustomerCode, TotalPrice
1, A000, £500.00
2, B000, £100.00
After inserting these records, it would then update the Status and InvoiceNo fields in the tblJobs so they look like this..
JobNo, CustomerCode, Price, Status, InvoiceNo,
1, A000, £100.00, Invoiced, 1
2, A000, £100.00, Invoiced, 1
3, A000, £200.00, Invoiced, 1
4, B000, £50.00, Invoiced, 2
5, B000, £50.00, Invoiced, 2
Any help would be greatly appreciated. If i knew where to start I would have a go and come back with the problems but I don't even know where to start!
Cheers
John
.NET 2.0, Visual Studio 2005, SQL Server 2005 Express