gunnar wrote: > select distinct(server_order_id), count(*) from ... group by server_order_id > ...
Please note that DISTINCT does not work this way; it always applies to all expressions in the SELECT clause, and "(server_order_id)" is just the same as "server_order_id". The query actually works because the GROUP BY already ensures that all values are distinct. Regards, Clemens