simple insert statement

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

Guest

This has got to work but it isn't. When I run it, the 'select' result pops up but the records are not inserting into t_FamilyMailing. Can someone tell me why?

INSERT INTO t_FamilyMailing ( FamilyID, MailingID )
SELECT a.FamilyID, 2 AS Expr1
FROM t_Family AS a
WHERE a.Flag=-1;

In case you're wondering what the table layout looks like...
1) t_Family
FamilyID (pk)
Name
Flag

3) t_FamilyMailing
FamilyID (pk)
MailingID (pk)
 
Hi,

I tested your query, exactly as written, and it worked perfectly.

The only reason I can think of to stop it, is if you have a mismatch of data
types, i.e. if familyID is a long integer in one table, and an integer in
the other. Although, I'm not going to say that that is the only possible
reason (covers butt) but it's worth checking.

HTH

MFK.


WarrenR said:
This has got to work but it isn't. When I run it, the 'select' result
pops up but the records are not inserting into t_FamilyMailing. Can someone
tell me why?
 
Are you executing (running) the query or merely switching to datasheet view?

Try clicking the Run (Red Exclamation) in the tool bar or selecting Query: Run
from the menu.

Switching to Datasheet view doesn't actually do an insert, it justs shows you
what it is about to insert.
 
Back
Top