It's other way around. You have to group on any none-aggregated columns in the query column list. You're not required to include columns you group on in the query result.
>A program error (by yours truly) caused several rows to be duplicated in a client's table.
>
>I needed a script to delete the dupes so I searched and found this little jewel.
>
>Other scripts involve temporary tables, etc but this simple script works like a charm.
>
>My newbie question is .. I thought you had to specify all the group by elements in the query result.
>Obviously you don't.
>What am I missing?
>
>
>
>DELETE
>FROM MyTable
>WHERE ID NOT IN
>(
>SELECT MAX(ID)
>FROM MyTable
>GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)
>
>
--sb--