insert with condition.

  • Thread starter Thread starter Mr. x
  • Start date Start date
M

Mr. x

what is the access-sql command for insert a record, with a condition.

something like this (which doesn't work) :

insert into myTable(col1, col2, col3) values(1, 2, 3)
where exists (select * from myTable2)
.....

Thanks :)
 
Perhaps you're thinking of something more like this?

Insert Into MyTable (col1, col2, col3) SELECT * FROM MyTable2

I'm not sure where the values (1,2,3) comes from, or how it's related to
MyTable2.

HTH
- Turtle
 
No...
I want to insert only at some cases (sometimes I want to insert records, and
sometimes I don't - can I do the condition in sql statement ?)

Thanks :)
 
If you mean that you only want to insert some of the records from MyTable2,
yes, you can certainly put a WHERE condition on the end of the SQL
statement.

HTH
- Turtle
 
Yes, but my code I have supplied doesn't work.

I get the message :
"missing semmicolon at end of sql statement".

Thanks :)
 
Back
Top