I have the following two columns in a table.
Now, based on the data (ids in second columns) sent in from the client, I want to return the id from the first column as the following:
Client sends in: 13, returns 24, 25 and 26
Client sends in: 1, returns 24 and 26
Client sends in: 1 and 13, returns 24 and 26
Client sends in: 1, 12 and 13, returns 26
How can I construct a SQL query like this? I've tried with in operator, but it returns wrong result in the last case where client sent in 1, 12 and 13. It returns all of them but I want only 26 in this case.
SELECT firstId FROM MyTable WHERE secondId in(1,12,13)
