For that i'm using below method
return await Patient.query().where('updated_at',CURDATE())with('cases').with('visits').first()
can u guide me how to get current date record
Are you getting any errors with this approach?
Hi Vrik,
Thanks for reply.
Your product is awsm.
error is CURDATE is not defined
i can also use Database.raw('') bt it gives [{"catalog":"def","db":"adonis","table":"patients","orgTable":"patients","name":"name","orgName":"name","charsetNr":33,"length":765,"type":253,"flags":0,"decimals":0,"zeroFill":false,"protocol41":true},
with result.
so, what'd i do for that?
I'm expecting User.whereDate('created_at',date)
Yeah it says CURDATE because you are calling it as a Javascript in your code. Whereas it must be passed as a string to MYSQL.
return await Patient.query().where('updated_at', 'CURDATE()')
still it is not woking,
updated_at giving 2018-05-02 12:32:15 and CURDATE() giving 2018-05-02
i think lucid dont compare both
return await Patient.query().where('updated_at', 'CURDATE()').fetch()
Lucid has nothing to compare here, it鈥檚 Mysql that compares.
Also when u say it鈥檚 not working, can u be more specific on what鈥檚 not working?
by using mysql query is
SELECT * FROMpatientsWHERE DATE(updated_at) = CURDATE()
how to convert this query into adonis
or
how to perform core query in adonis and get excet mysql result
Maybe CURDATE() needs to be wrapped in .raw('CURDATE()')?
thanks for reply
Bt still its not working
Closed for housekeeping reasons.