Retrieve a record with fromdate and todate by passing single date in MySQL
datetime, hql, java, mysql, sql
Solution
You can use the `BETWEEN` clause. Assuming from and to dates are inclusive, you would write:
SELECT ...
WHERE '2015-02-13' BETWEEN fromDate AND toDate
Problem
Here I have a Database Table with fromDate and toDate field. My requirement is to retrieve all records with a specific date(it can be either fromDate or toDate or in between fromDate and toDate). TableName: MyTable I need to find a record with date 13/2/2015 (it can be either fromDate or toDate or in between fromDate and toDate). What will be the query to find such record?