insert with condition.

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 :)
 
M

MacDermott

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
 
M

Mr. x

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 :)
 
M

MacDermott

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
 
M

Mr. x

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

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

Thanks :)
 

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

Top