0

query1:

SELECT count(*) 
from covips.pool_checkup 
WHERE timeinstance > DATE_ADD(NOW(), INTERVAL -1 HOUR)
cursor.execute(query1)
count2 = cursor.fetchone()[0]
print("test ", count2)

ERROR I AM GETTING IS

Error while connecting to PostgreSQL syntax error at or near "HOUR" LINE 2: ...p

WHERE timeinstance > DATE_ADD(NOW(), INTERVAL -1 HOUR)
1

1 Answer 1

1

Your query uses MySql syntax for a Postgresql database where there is no DATE_ADD() function.
This is the correct syntax:

WHERE timeinstance > NOW() - INTERVAL '1 hour'
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.