Select statement having multiple conditions over multiple columns
A part of my table is as follows,
ID|Key|Value
------------
1 | A | V1
2 | B | V2
3 | C | V3
I know the following query would definitely return no result, but then
what is the correct query of achieving a positive result, i.e. '1'. I have
mentioned '1' in the Select statement because this value will then be
passed on to a Cursor.
select 1 from myTable
where (key = 'A' and value = 'V1')
AND (key = 'B' and value = 'V2');
Let me know if the design of the table itself needs some change.
No comments:
Post a Comment