At 17:00 -0600 9/10/04, René Fournier wrote:
>I've got a SELECT statement that is returning
>the data I want, but not in the right order (and
>I don't know why...). Let's say there are two
>tables, People and History. Some records in
>People have corresponding records in History,
>but not all--so I need a LEFT JOIN TO connect
>history.people_id to people.id. So far, so good.
>But I want to order the list according to the
>timestamp column in history (history.time_sec),
>and this does not happen: Records are returned,
>but not in the right order. Here's my query:
>
>SELECT *
>FROM people
>LEFT JOIN history ON people.id = history.people_id
>GROUP BY people.id
>ORDER BY history.time_sec DESC
>
>It seems I can sort correctly on a field in
>people, but not on a field in history-is that
>because it is a left-joined table?
We might be able to give you an answer if you show some results
and indicate why you believe they are incorrect.
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com