Hi, I need to create query form with date parameteres: date_from and date_to for date attribute.
with following behaviour:
- when date_from and date_to are empty values, the result set must contain all the objects from the that type
- when date_from has a value and date_to is empty value the result set contain all the objects whose date attribute value is bigger or equal to date_from
- when date_from is empty value and date_to has a value the result set contain all the objects whose date attribute value is less or equal to date_to
- when the user chooses date_from and date_to in the query form, the result set must contain all objects whose date attribute value between the chosen date_from and date_to
Something like:
SELECT *
FROM <table>
WHERE
(date_from IS NULLDATE OR <date_attribute> >= date_from)
AND
(date_to IS NULLDATE OR <date_attribute> <= date_to)