I am not getting the right result from my below query:
SELECT t.id as TaskId, cl.name as ClientName, p.name as ProjectName
, t.name as TaskName, tp.name as TaskType
, t.createdate as DateCreated,t.enddate as DueDate
, u.firstname as TaskOwner, pr.name as Priorities
, t.hours as AllotedHours, t.workedhours as LoggedHours
, tl.firstEntry, tl.lastEntry
FROM tasks t
inner join (
select distinct tasks_id,complete, createdate
, min(createdate) as firstEntry, max(createdate) as lastEntry
from tasklogs
WHERE complete in (90)
and createdate > '2018-08-25'
GROUP BY createdate
) AS tl
ON tl.tasks_id = t.id
inner join projects p
on p.id = t.projects_id
inner join tasktypes tp
on tp.id = t.tasktypes_id
inner join users u
on u.id = t.users_id
inner join priorities pr
on pr.id = t.priorities_id
inner join clients cl
on cl.id = p.clients_id
where p.projecttypes_id=1 ;
I am supposed to get a single result with firstEntry (first log) and lastEntry (last log) columns, but I'm getting multiple rows for each selection:
As you see in the below image I am getting 3 rows, I need one row with highlighted First entry of 90 and last entry of 90 complete. Maybe my query is the wrong way to do that?