I have table named offers
.It has following columns
is_special
having value true or falsenormal_expiry_date
having a date valuespecial_expiry_date
having a date value
Now if row has is_special = false
then I want to use where normal_expiry_date > current_date
,if
is_special = true
then where special_expiry_date > current_date
Thanks a lot to you even if you tried to help
Advertisement
Answer
One option would be
where current_date < case when is_special = false then normal_expiry_date when is_special = true then special_expiry_date end