I need to find all rows from database table, for which the difference between columns date_start and date_end is exactly 3 days. I looked through postgresql documentation like http://www.postgresql.org/docs/9.1/static/datatype-datetime.html, and have already created several queries, for example:
"SELECT e FROM Events e WHERE date_part('day',(e.date_end - e.date_start)) = 3"
but unfortunately my editor give an error "The query contains a malformed ending" and "The identification variable 'date_part' is not defined in the FROM clause" (Eclipse). Could anyone explain me, where is my mistake?
EDIT1:
Maybe eclipse does not know all postgresql functions and I have to import some library or add something into query to make date_part function visible for the environment?
Unfortunately I did not find solution using postgresql queries, just cause my eclipse editor always give me an errors referenced to the postgresql functions (do not know some of them). But I found some around way. Just selected general information from the table, and all required checkes I have done in java classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With