INSERT INTO person_data('Key','value',Person_id)
SELECT 'aaa','bbb',1, FROM person_data;
could someone please indicate what is the issue with the above statement? is that because 'key' and 'value' are sensitive words? Any help?
INSERT INTO person_data('Key','value',Person_id)
SELECT 'aaa','bbb',1, FROM person_data;
could someone please indicate what is the issue with the above statement? is that because 'key' and 'value' are sensitive words? Any help?
Key is a column name which also happen to be keyword and should not be put inside qoutes but backticks. Also remove last comma in Select list.
INSERT INTO person_data
( ` KEY ` ,
value,
person_id)
SELECT 'aaa',
'bbb',
1
FROM person_data;
INSERT INTO person_data(`Key`,`value`,`Person_id`) VALUES ('$key', '$value', '$Person_id')
SELECT * FROM person_data;
There is no need to quote the column names. Try this:
INSERT INTO person_data(Key,value,Person_id) SELECT 'aaa','bbb',1, FROM person_data;