In my database, I want to filter the data by date : I have multiple checkbox for that. When I check 2018-2019
for example, I want to get every information between '2018-09-01' and '2019-08-31'
. I managed to do that. What I can’t figure out how to do is when I check two of the checkbox.
I tried using OR
by doing something like that :
AND (date_conseil BETWEEN '2018-09-01' AND '2019-08-31') OR (date_conseil BETWEEN '2017-09-01' AND '2018-08-31');
But I only get an error “Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes)”. I really have no idea why I get this and why my SQL doesn’t work.
Can you maybe give me a little help ? Thanks
Advertisement
Answer
Use like this, look the (
)
and the OR
, it is inside pharentesis.
AND (date_conseil BETWEEN '2018-09-01' AND '2019-08-31' OR date_conseil BETWEEN '2017-09-01' AND '2018-08-31');