Posts Tagged ‘LAST_INSERT_ID’

Insert into multiple MySQL tables with one-to-one relationship




I have been asked if there is a way to insert data into two MyISAM tables that connected by a one-to-one relationship in one MySQL query. For example: mysql> CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default ”, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1   mysql> […]