Help with Update query

mufasa

Kamnandi
Local time
Today, 18:02
Joined
Sep 21, 2005
Messages
6
HI There

I have 2 tables Table1 (T1_ID int, Invoice_no vchar) and Table2(T2_ID int, Invoice vchar, Product vchar).

The problem I have is that my client has records in Table2 Invoice with data from Table1 Column T1_Id and Invoice_no.

What I would like to do is to update Table2 Invoice with only the data from Table1 T1_ID

Table1
T1_ID ______________ Invoice_No
1___________________635
2___________________646
3___________________985

Table2
T2_ID___________Invoice________Product
1______________1______________beans
2______________646____________Bananas
3______________3______________Apples
 
Not sure what the question is, but here goes:
You want to delete records from table2 when InvoiceNo not in Table1?
Code:
Delete * from Table2 where Invoice not in (Select Invoice_No from Table1)
This query removes "beans" and "Apples" from table2

HTH
 
I think your example is a little mis-leading as you are using the same numbers for T1_ID and T2_ID. If I have read this correctly this is not the case.

Try:

UPDATE Table1 INNER JOIN Table2 ON Table1.Invoice_No = Table2.Invoice SET Table2.Invoice = [Table1]![T1_ID];
 

Users who are viewing this thread

Back
Top Bottom