且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在插入查询中使用选择查询以获取相同的表名

更新时间:2023-02-26 10:15:32

将您的插入内容更改为如下所示:

Change your insert to look like the following :

insert into sample_elements (name,position,ownerel) select 'Namespace1',id,0 from sample_elements where name='Namespace1';

基本上不使用值,而仅使用select语句并将经过编码的值作为列插入

Basically instead of using values only use the select statement and insert the harcoded values as columns