Subject RE: [firebird-php] FireBird/ADODB
Author Alan McDonald
> > Next problem is soting thru all the SQL which doesn't make sense
> >
> > e.g.
> >
> > SELECT t.*, p.project_title, p.project_is_active, lst.status_name AS
> > status_name,
> > lt.tasktype_name AS task_type, lr.resolution_name
> > FROM FS_tasks t
> > LEFT JOIN FS_projects p ON t.project_id = p.project_id
> > LEFT JOIN FS_list_tasktype lt ON t.task_type = lt.tasktype_id
> > LEFT JOIN FS_list_status lst ON t.item_status = lst.status_id
> > LEFT JOIN FS_list_resolution lr ON t.resolution_reason =
> lr.resolution_id
> > LEFT JOIN FS_assigned ass ON t.task_id = ass.task_id
> > LEFT JOIN FS_users u ON ass.user_id = u.user_id
> > WHERE ( is_closed <> '1' )
> > GROUP BY t.task_id
> > ORDER BY task_severity desc, t.task_id desc, t.task_id ASC
> >
> > no idea why anyone thinks the GROUP BY clause makes any
> sense... (apart from
> > being illegal)..
> > what, if anything, do you think the writers of this query were
> trying to do
> > with the GROUP BY which the ORDER BY alone doesn't do?
>
> I've seen some strange stuff.
> As you say - t.task_id is not being used to consolidate anything,
> so the GROUP
> BY is irrelevant - but I'd need a closer look to see if they have
> something
> selectable that MIGHT need it - but I doubt it.
> Is the ORDER BY correct? can you have desc and asc on the same field?
>
> The other one that can be fun is the JOIN order, but that is
> usually just bad
> table design and these look OK.
>
> --
> Lester Caine - G8HFL

you're right - didn't even notice the duplicate task_id order. That's
nonsense.
I would expect the first one to be overridden by the second.
Alan