 |
sneha Level: Scholar
 Registered: 28-03-2006 Posts: 29
|
Help on SQL querry ...
quote: Chris_871 wrote:
Hi
Insert query for your sales table..
SqlSales = "Insert into Sales (CustomerName,InvoiceNo,InvoiceDate,InvoiceAmount) values ('" & trim(custname) & "','" & trim(invno) & "'," & (invdate) & "," & (invamt) & ")"
Regards
Chris
Thanks.
Actually I need the Insert Querry for the Target Table " AccountsBalance" with the following fields from Sales table and Payment table:
CustomerName
InvoiceDate
InvoiceAmount
from Sales table &
PaymentDate
PaymentReceived
from Payment table
Thanks in Advance.
____________________________
Sneha
|
|
29-03-2006 at 08:02 AM |
|
|
Chris_871 Level: Master

 Registered: 30-11-2002 Posts: 106
|
Re: Help on SQL querry ...
Hi
In your payment and Accountbalance table , you should have invoiceno field. Then only you can insert into accountbalance table. Also you may receive myltiple payments for a single invoice. So you should design your table according to that.
Here is the insert qiery..
Insert into accountbalance (customername,invoicedate,invoiceamount,paymentdate,paymentreceived,invoiceno)
(select sales.customername,sales.invoicedate,sales.invoiceamount,payment.paymentdate,payment.paymentreceived,payment.invoiceno from sales,payment where sales.invoiceno = payment.invoiceno and sales.invoiceno = '1001')
In this query I have used sales.invoiceno = '1001'.
You may use like this,
sales.invoiceno = '" & trim(txtinvno.text) & "'
Regards
Chris
|
|
29-03-2006 at 09:35 AM |
|
|
sneha Level: Scholar
 Registered: 28-03-2006 Posts: 29
|
Re: Help on SQL querry ...
Hi,
Could you please write querry for my tables which I have mentioned in the above post. Please note that there is no relation between any fields from Sales table to Payment table.
Regards.
____________________________
Sneha
|
|
29-03-2006 at 01:51 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Help on SQL querry ...
Please do not make duplicate posts.
http://www.andreavb.com/forum/viewtopic.php?TopicID=6580&page=0#23436
[Edited by Goran on 30-03-2006 at 12:40 AM GMT]
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
29-03-2006 at 11:38 PM |
|
|
|
|
 |
 |