Saturday, January 15, 2022

[FIXED] Allowed memory size exhausted when I use "OR"

Issue

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


Solution

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');


Answered By - Roy Bogado

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.