Seven price
asked on
insert using where clause.
INSERT INTO table1 where userid = 419
select store from table2
how can I select from one table and insert into another but using a where clause in the insert statement. this way it will only insert where the userid is 419
select store from table2
how can I select from one table and insert into another but using a where clause in the insert statement. this way it will only insert where the userid is 419
I'm not clear on your question, but below Syntax will help up to insert record of userid = 419 from table2 to table1
INSERT INTO table1
select store from table2 where userid = 419
INSERT INTO table1
select store from table2 where userid = 419
ASKER
well table2 I need to select all stores and insert them into table 1 but table 1 has multiply stores so I must insert all stores but insert them with row value 419
example
table 1
userid storeid
419 store1
419 store2
419 store3
419 store4
table2 where I need to select all stores is just
storeid
store1
store2
store3
store4
example
table 1
userid storeid
419 store1
419 store2
419 store3
419 store4
table2 where I need to select all stores is just
storeid
store1
store2
store3
store4
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
work great
I had a typo in that last one, glad you figured it out!
You may need to change 419 to '419'
INSERT INTO [table1] ( store )
SELECT table2.store
FROM table2
WHERE (((table2.userid)=419))