Closed permadart closed 5 years ago
Hi,
Almost all can be done via RushSearch only thing you have to do is actually create the date objects you want to search between.
Date now = new Date();
Date in14Days = // TODO
UserMeals userMeal = new RushSearch()
.whereBefore("date_of_meal", in14Days)
.and()
.whereAfter("date_of_meal", now)
.and()
.whereEqual("email", email)
.limit(1)
.orderDesc("date_of_meal")
.findSingle(UserMeals.class);
Note I have written this free hand do double check the logic.
Cheers
Thanks again, man. Will try it ASAP.
Cheers!
Hello. I have a String saving a date in my db.
I have this SQL working on my remote db
SELECT * FROM user_meals WHERE CURDATE() BETWEEN date_of_meal AND DATE_ADD(date_of_meal, INTERVAL 14 DAY) AND email = '$email' ORDER BY date_of_meal DESC LIMIT 1
Is there a way I could achieve the same with RushORM for my local db?