Reputation: 443
I am trying to insert values by extracting from another table but I got exception
sqlsyntax error while trying this way
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);
Upvotes: 2
Views: 51
Reputation: 3916
Change your query as follow. Use Backtick
symbol
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
Upvotes: 1