如何制作此 select 语句的插入语句?
SELECT et
FROM user
inner join petrazafa.class_room
using(id)
where title like '%11%'
or title like '%12%';
我需要插入 all et
= 1;
谢谢
如何制作此 select 语句的插入语句?
SELECT et
FROM user
inner join petrazafa.class_room
using(id)
where title like '%11%'
or title like '%12%';
我需要插入 all et
= 1;
谢谢
编辑 1:
我认为这里有一个答案:在插入查询中使用选择查询以获得相同的表名
为你 :
INSERT INTO `yourtable`(et)
SELECT et
FROM user
inner join petrazafa.class_room
using(id)
where title like '%11%'
or title like '%12%';
观看文档:
文档示例:
INSERT INTO tbl_temp2 (fld_id)
SELECT tbl_temp1.fld_order_id
FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;
尝试类似的东西
INSERT INTO user( 1 as et )
SELECT et
FROM user
inner join petrazafa.class_room
using(id)
where title like '%11%'
or title like '%12%';
据我了解,您想et=1
更新title like '%11%' or title like '%12%'
为了那个原因
update user u inner join petrazafa.class_room c on u.id=c.id set et=1 where title like '%11%'
or title like '%12%'