To get output in a particular order, use ORDER BY. It will always take precedence. Without ORDER BY, data is not necessarily returned in any particular order, but DISTINCT is processed similar to GROUP BY, and GROUP BY necessarily has to order the data in order to group it, so it will have an effect on the order in the absence of ORDER BY.
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --