Append records from a select query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Current Attempt:

INSERT INTO New_Cntrs
SELECT Clean_Export LEFT JOIN New_Cntrs ON Clean_Export.Rec_Ident =
New_Cntrs.Cntr_Code
FROM Clean_Export
WHERE Clean_Export.Rec_Ident in (
SELECT Clean_Export.Rec_Ident
FROM Clean_Export LEFT JOIN Cntr_Checks ON Clean_Export.Rec_Ident =
Cntr_Checks.Cntr_Code
WHERE (((Cntr_Checks.Cntr_Code) Is Null))
);

The nested Select statement does return my wanted result. My issue is in
the Insert statement.
Here is my verbal explination:
If the Clean_Export.Rec_Ident field is present in the nested select query I
want to append it to New_Cntrs.Cntr_Code
 
Dear Julia:

Are you saying the select query returns more rows than what you want to
append?

You say:

"If the Clean_Export.Rec_Ident field is present in the nested select query I
want to append it to New_Cntrs.Cntr_Code"

It seems you should filter the SELECT query to show only those rows in which
the Clean_Export.Rec_Ident column is present. Perhaps you mean that it is
not null. So, add that to the SELECT query:

The SELECT part of your query posted here doesn't read well to me. It say
to SELECT Clean_Export (one column I guess) then launches into a LEFT JOIN
without a FROM clause first. That doesn't sound good to me.

Could you post just the SELECT query you say gives what you want?

Tom Ellison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top