Firstly i apologize for vague question title, i am not sure what to write there. Please let me know and i will update it.
Now here it goes..
I have 3
Table : target
Columns : target_id , target_employee_id, target_location_id, target_location_name, target_scheduled_on, target_exec_end_time, target_damaged, target_damaged_text
Table : employee
Columns : employee_id, employee_manager_id
Table : location
Columns : location_id, location_name
Little Explaination-> Managers role is to create a target for employee meaning a new target will have the location name and the scheduled on. Then employee will visit that location and report if there are any damages. This can happen multiple times in a month for same location.
What i need to show-> a list of targets having damages – between two dates (target_exec_end_time) and if there are multiple records of that same location then show the one having max date.
More Explaination-> There can be multiple entries of targets having same location but i need to show only one instance. target table image
I have tried my best to explain. Thanks in advance.
How about this:
Not sure about having both
target_exec_end_timeclauses in the where though. Maybe you just want the max value?