Reputation: 5299
I have sql like following.
select *
from table
where
c.date >= date_sub(current_date(), interval 4 day)
But it returned following errors
Syntax error at or near Line 19, Position 35
This error was caused by current_date()
. How can I avoid this and how can I get current date ?
If someone has opinion,please let me know
Thanks
Upvotes: 0
Views: 508
Reputation: 24593
date_sub() function is only available in Mysql , and current_date in postgresql is not a function.
here is the correct postgresql syntax:
select *
from table c
where c.date >= current_date - interval '4 day';
Upvotes: 2