sql - MySQL UPDATE and DELETE Conundrum -
sql - MySQL UPDATE and DELETE Conundrum -
i've got table 2 column: applicationid
, studentid
. want update applicationid
new value applicationid
equal old value , studentid
not equal (studentid
applicationid
equal new value). table looks this, , want update 2222222222222 applicationid
1111111111111, not always:
--applicationid-- --studentid-- --1111111111111-- --111111111-- // right here! --1111111111111-- --555555555-- --2222222222222-- --666666666-- // here want update application id 1111111111111 --2222222222222-- --111111111-- // want delete row, because update result exists! ^^ --2222222222222-- --777777777-- // want row updated.
this query i've got, update applicationid
new value, if result exists:
update students_applications set applicationid = 1111111111111 applicationid = 2222222222222
any thoughts?
thanks in advance.
something this?
delete table studentid = '111111111' , applicationid <> '111111111111111'; update table set applicationid = '11111111111111';
mysql sql where equals
Comments
Post a Comment