vendredi 21 août 2015

SQLite :select where currend date between from date and to date if exist

I have a db with records that have a fromDate and toDate field.

For getting the active record i use : datetime('now') between fromDate and toDate; That works fine.

The thing is that the fields are not always populated.

I want that if the is no fromDate and no toDate i will always receive the record

If there is only a fromDate then after that date i will always receive the record I

If ther is only a toDate i will receive the record only until the toDate.

Thanks a lot

Avi

Aucun commentaire:

Enregistrer un commentaire