How can I getting the previous month's from current date in query? #3825
Unanswered
positivedeveloper36
asked this question in
Help
Replies: 2 comments
-
Hello, First, there is an issue but could only be related to this code - [Env.get('MONTHS'])
+ [Env.get('MONTHS')]) Maybe you can try to write all in binding .whereRaw("created_at > CURRENT_DATE - INTERVAL ?", [`${Env.get('MONTHS')} months`]) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm sorry, I typed it wrong, but that also doesn't work Apparently it can't use bindinng |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My code like this :
The result of query like this :
select * from "users" where created_at > CURRENT_DATE - INTERVAL ''3' months' order by "created_at" desc
There is a problem with the quotes. How can I remove the quotes to be like this :
select * from "users" where created_at > CURRENT_DATE - INTERVAL '3 months' order by "created_at" desc
Please help. Thank you
Beta Was this translation helpful? Give feedback.
All reactions