+------------------+
| id1 | id2 | bool |
+------------------+
| 1 | 1 | F |
| 1 | 2 | F |
| 2 | 1 | F |
+------------------+
UPDATE table_name
SET bool = T
WHERE (id1, id2) IN ((1,1),(2,1)) --Need work here
So basically I want to select where the conditions of (id1, id2) = (value1, value2).
Similar to the statement below:
WHERE id1 = value1 AND id2 = value2
however in set of values in an array.
Is this possible?
Thanks in advance
EDIT: I’m using SQL server 2008. I’m sorry if it wasn’t too clear.
I’m trying to put this as a stored procedure and call it from a service. The input would be some sort of an array (variable size), and find a match with the two IDs in a row.
Here is the way to do it in MSSql. All you need is to make one value (in this example VARCHAR) from Id1 and Id2. In this case you can use IN statement with the values set. Also you should think about NULLs in id1 and id2 if they are allowed in these fields (just add:
and id1 is not null and id2 is not null).