I have 2 tables, events and event_users:
Events
id int
type int
date date
time time
Event_users
event_id int
user_id int
user_role int
...
Events can have many event_users (one-to-many relationship).
When I insert more than one event in the Events table, the query is:
INSERT INTO events
(type,date,time)
VALUES
(1,12-02-14,08:15:00),
(1,13-02-14,08:15:00),
(1,14-02-14,08:15:00),
(1,15-02-14,08:15:00)
But at the time I know the events table info, I also know some of the event_users table info.
So, because I need the events.id to write the event_users record, how can I insert the events and the event_users records in one query? The database is MySQL.