how to return the list of records by one copy from the database where the records are by two or more copies i. e. if the records are 1, 1, 2, 2, 2, 3, 4, 4, 4, 4 in a DB column, so i want it to be returned only by one copy as below 1 2 3 4 i'm using the script below [ dim q q="select ddate from ddate_table" dim r set r=c.execute(q) do while not r.eof %> <td><tr><%=r("ddate")%></td></tr> <% r.movenext loop ]
A DISTINCT and GROUP BY usually generate the same query plan, so performance should be the same across both query constructs. GROUP BY should be used to apply aggregate operators to each group. If all you need is to remove duplicates then use DISTINCT. If you are using sub-queries execution plan for that query varies so in that case you need to check the execution plan before making decision of which is faster. HTH Regards
If you ask yourself which one is more efficient then i assure that their performance is usually identical. It is up to you which one you will use. I would say that is in only a matter of taste.