Hello All,
My apologies if this question has already been answered elsewhere, I did try searching for it, but perhaps did not use the correct search term. Here is my dilemma.
I have a table that contains multiple columns, and I need to select rows based on a combination of values, for example, my table looks like
NAME
| FOOD | DAY |
---|
John | Burger | Sunday |
Jane | Burger | Monday |
John | Pizza | Sunday |
John | Pasta | Sunday |
John | Burger | Tuesday |
Jane | Burger | Tuesday |
Jane | Pasta | Wednesday |
So if I want information on which Sunday's john ate burgers for, and which Wednesday's Jane had pasta on.
My query would have to look like
select DAY, NAME, FOOD from FOOD_TABLE FT
WHERE
(DAY='Sunday' and NAME='John')
OR
(DAY='Wednesday' and NAME='Jane')
While it is possible for a table of 6 rows with 2 persons, it would become cumbersome as the conditions increase.
So, my question is, is there a simpler way to do what I am trying?