is it possible to update multiple row with multiple where?
id | formid
PK 1 | 2
PK 2 | 2
i need to switch id 1 to 2 and 2 to 1 also need to filter with where formid = 2. is it possible ?
is it possible to update multiple row with multiple where?
id | formid
PK 1 | 2
PK 2 | 2
i need to switch id 1 to 2 and 2 to 1 also need to filter with where formid = 2. is it possible ?
You can do that...by using this query
update mytbl a
inner join mytbl b on a.formid <> b.formid
set a.id = b.id
where a.id in (1,2) and b.id in (1,2)
Have you tried anything that does not work?
This is a problem of switching 2 values. You can try with temporary variable as said here.
Another option in by join, as stated here.