问题描述
insert into orderfield(a,b) values select order_num ,order_time from c_yqwx_order; 以上代码在navicat中运行成功,在idea中运行报错,提示为:check the manual that corresponds to your MySQL server version for the right syntax 。
把sql标签insert改为select,报错提示为 :net.sf.jsqlparser.statement.insert.Insert
can no cast into net.sf.jsqlparser.statement.select.Select
功能描述
一条sql完成 从表A中查出两列数据,转存储到表B的两列中,
想请教各位,这个sql需要怎么改改,或者我需要使用那个特定的数据库方言?
insert into orderfield(a,b) values (select order_num ,order_time from c_yqwx_order)
加个括号试试
insert into orderfield(a,b) values as select order_num ,order_time from c_yqwx_order;
把 values 去掉就可以了;
insert into orderfield(a,b) select order_num ,order_time from c_yqwx_order;