Reputation: 309
I have a SQL query:
select recipe_title
from recipe where
meal_type ='BREAKFAST'
Is it possible to match any meal_type by only change the BREAKFAST
?
Such as:
select recipe_title
from recipe where
meal_type = *
I know I can use like %%
but that will need to change many places in my code. Is it possible to get all meal_type and still use =
Thanks!
Upvotes: 1
Views: 2035
Reputation: 14091
No. =
is an equality operator. The best you can do is WHERE meal_type = ANY('{BREAKFAST,LUNCH,DINNER}')
, iff you have a known short list of all possible values, but there's no wildcard-like behavior with =
. The correct way of doing this (returning all rows regardless of meal_type
) is to not have a meal_type = <whatever>
in your WHERE clause.
Upvotes: 2