我试图通过从另一个表中提取来插入值,但尝试这种方式时出现exception
sqlsyntax错误
int row=st.executeUpdate("insert into bug_history (bug_h_id,type,summary,desc,ans)
select bug_id,type,summary,desc,solution
from bug_details
where bug_id="+bug_id);
答案 0 :(得分:1)
更改您的查询,如下所示。使用Backtick
符号
INSERT INTO bug_history (`bug_h_id`, `type`, `summary`, `desc`, `ans`)
SELECT `bug_id`, `type`, `summary`, `desc`, `solution`
FROM bug_details
WHERE bug_id = bugID