So, I have a view report display that filters Period From and Period To, as shown below:

And, I have employee data with dates like this:
When I display the report, the date range data is unreadable. It should show up because start_date is on January 17th and end_date is on January 21st..
This is my query, please help.. thanks.
->select("a.id, a.employee_id, a.employee_name, a.leave_name, a.start_date, a.end_date, a.status,
b.id, b.employee_id, b.job_title_name, b.employment_status_name")
->join('hr_employee b', 'a.employee_id = b.employee_id', 'left')
->where("(a.start_date <= BETWEEN '$data[from]' AND '$data[to]') OR (a.end_date >= BETWEEN '$data[from]' AND '$data[to]')");
return $this->db->get('hr_leaves a');
->where("(a.start_date <= BETWEEN '$data[from]' AND '$data[to]') OR (a.end_date >= BETWEEN '$data[from]' AND '$data[to]')");
CodePudding user response:
From <= End_Date AND To >= Start_Date, where From/To are user data, and [Start/End]_Date are the table columns.


