I know I can use CASE statement in an SQLite query but I don't know how to built it in a WHERE clause.
Actually I have this in a long WHERE clause (this is just the part concerned by the question):
AND (%d >= (wines.year + wines.maturity)) AND (%d < (wines.year + wines.apogee))
In fact I want just that :
AND (%d >= (wines.year + wines.maturity))
=> if wines.apogee IS NULL
or also:
AND (%d >= (wines.year + wines.maturity)) AND (%d < (wines.year + wines.apogee))
=> if wines.apogee IS NOT NULL
How to use the CASE statement in this case to test if wines.apogee IS NOT NULL and add the second part of the request in this case ?
Thanks !