I have 2 tables
Table NAME (id, name, phone, city, state, rid)
Table NAMES2 (id, name, phone, city)
This SQL statment is not working:
INSERT INTO NAME (id, name, phone, city, rid) VALUES ((SELECT id, name, phone, citY from NAMES2 WHERE city=”Bangalore”),’72’)
I want rid field in Table NAME to have 72 for all the records inserted from table NAMES2.
Note: both the tables are not identical.
Try this query –
If field
ridhas default value 72 (run SHOW CREATE TABLE to view it), then you can use this query –