I have a table with a next structure:
+---------+----------+-------+ | user_id | group_id | onoff | +---------+----------+-------+ | 1 | 3 | 1 | +---------+----------+-------+
Here is many users and many groups. Currently max group is 18.
How can I insert group_id=19 with onoff=1 for all users in the table? (I mean insert in one query)
Just use a subselect clause to insert your values (MySQL docu).
Example can be seen at this sqlfiddle.