MySQL以关联ID同时插入多表
今天写的语句,备忘一下
MySQL真是还有好多要学的地方,呵呵
语句和查询次数可以大大的减少
INSERT INTO `title` VALUES ( NULL , 0, 'title1', '' , 0, 0, '');
INSERT INTO `article` VALUES (last_insert_id(),'content1');
INSERT INTO `title` VALUES ( NULL , 0, 'title2', '' , 0, 0, '');
INSERT INTO `article` VALUES (last_insert_id(),'content2');
INSERT INTO `title` VALUES ( NULL , 0, 'title3', '' , 0, 0, '');
INSERT INTO `article` VALUES (last_insert_id(),'content3');
INSERT INTO `article` VALUES (last_insert_id(),'content1');
INSERT INTO `title` VALUES ( NULL , 0, 'title2', '' , 0, 0, '');
INSERT INTO `article` VALUES (last_insert_id(),'content2');
INSERT INTO `title` VALUES ( NULL , 0, 'title3', '' , 0, 0, '');
INSERT INTO `article` VALUES (last_insert_id(),'content3');
Incoming search terms:
- insert
- mysql多表插入
- mysql 多表插入
- mysql 关联插入
- mysql关联插入
- mysql 多表关联插入
- 多表联合插入
- MYSQL 关联表插入
- mysql 联合插入
- mysql多表关联插入
- mysql 关联表 快速插入
- mysql insert 多表关联
- mysql 多表插入关联表
- mysql insert into 同时插入多表
- 同时插入多表
- mysql插入多表
- 多表关联插入
- mysql 同时插入多张表
- streetnl9
Tags: mysql
bug exist
上次用手机不方便,这次补上。
需要事务才行,不然并发会有问题
验证码:win
楼上的兄弟说得没错,居然还有人用手机上我BLOG...汗
我说的真的没错吗?呵呵