Mysql query violation - Java -
i have 2 attributes in table called surname , firstname. in application, have combobox displays first name , surname together.
but want update table using displayed name in combobox clause getting error query.
for instance;
in table
surname - overflow
firstname - stack
now, in combobox, displayed stack overflow , below query want update with.
string query = "update students set status = 1 surname,firstname=?"; pst.setstring(1, findperson.getselecteditem().tostring());
is right way concatenate surname , firstname in query?
if surname , firstname divided ' ' (space) following query should want.
string query = "update students set status = 1 concat_ws(' ',surname,firstname) = ?";
see https://dev.mysql.com/doc/refman/5.7/en/string-functions.html more details.
pst.setstring(1, findperson.getselecteditem().tostring());
Comments
Post a Comment