vendredi 24 juillet 2015

PostgreSQL in pgAdmin Query with IF ELSE in WHERE

I have this query:

SELECT "visits".*

FROM "visits"

where   

    '2015-06-20' between start_date and end_date

or

    if (end_date is null) then end_date = '9999-01-01'

i'm using POSTGRESQL 9.4.

The question is:

How to test if a date is in a range also without end_date in some rows?

IF ELSE THEN doesn't work in my pgAdmin also if I use 1=1 or similar...

How to write it?

Aucun commentaire:

Enregistrer un commentaire