0

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

1 Answer 1

2

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';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.