i have small problem with inserting data into my table “events”
+-------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | longtext | YES | | NULL | |
+-------+----------+------+-----+---------+----------------+
from my view old_data:
+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| event | text | YES | | NULL | |
+-------+------+------+-----+---------+-------+
I want to insert data from field “event” from view old_data into “name” field in table “events” to do this i was trying to use commands:
insert into 'events' ('name') select 'event' from 'old_data'
insert into 'events' ('name') select 'event' from 'old_data' group by 'event';
etc etc. Every time it’s syntax error. WHY?!
Your use of apostrophe delimiters around your identifiers is incorrect (they are for delimiting strings). Try:
If you want to use delimiters around identifiers, you should use backtick (
`):From the MySQL manual: