I have a two part question:
First I want to insert data into a table and I am using the following
command:
INSERT INTO tblmain
SELECT field1, field2, etc...
FROM tblimport
WHERE ??????
The where clause is the part I am having trouble with. I want to only insert
the rows where field F1 one doesn't exist in table tblmain. What would the
where clause look like? I am using MS-Access to transfer the data from a
flat file to a SQL data base because I do not know that much SQL
programming.
Second part of the question is that after the data is inserted I want to
pull out a field in tblmain (pat_id which is only generated when a new line
of data is inserted into tblmain) and place the value in the table tblimport
(in field pat_id) but only where fields F1 match in both tables.
I don't want to find the pat_id when I insert data because there will be
cases when the data in the tblimport is already in the tblmain and I don't
want to change the data in the tblmain.
Does that make any sense? It sounded ok in my head...
Thanks in advance...
Mike Charney