DATE_SUB gives 0 results - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: DATE_SUB gives 0 results (/showthread.php?tid=82455) |
DATE_SUB gives 0 results - BFlokstra - 07-12-2022 Hi guys, I know this question isn't specifically CI related, but I hope you'll endulge me a little. I have two tables: evenementen: evenement_id INT (Primary, A_I) evenement_begindatum DATE evenement_einddatum DATE evenement_begintijd VARCHAR(5) evenement_eindtijd VARCHAR(5) evenement_vrijwilligers evenement INT (Primary) vrijwilliger INT (Primary) gedeclareerd BOOL I am trying to get all events where a specific volunteer has gone to, as long as that volunteer has not made a claim for the travel allowance for that event yet. And as long as the event has not been more than 2 months ago. I have the folowing Query, but with the DATE_SUB() part of the query, I get 0 results. Even though I should be getting 2 in this case. Code: SELECT RE: DATE_SUB gives 0 results - JustJohnQ - 07-13-2022 Looks like you are subtracting -2 months from the given date. Try: Code: [code]evenementen.evenement_einddatum >= DATE_SUB(NOW(), INTERVAL 2 MONTH) |