On Mon, May 21, 2012 at 9:18 AM, Peter Cushing <[email protected]> wrote: > > Ted Roche wrote: >> Yes, there is. http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt >> >> There are two uses of DISTINCT in a SQL SELECT statement: >> >> SELECT DISTINCT <fieldlist>... creates a set of rows with unique >> values: no two rows are identical, although individual column values >> may be repeated. >> >> SELECT <fieldlist, including SUM(DISTINCT fieldname)> selects >> aggregate operations (like SUM, but the others, too: AVG, STDDEV, etc. >> as well as COUNT) on unique values. >> >> > I've only ever used COUNT(DISTINCT myfield) and was curious about what > use the others could be. > > Anyone think of a situation where SUM(DISTINCT AVG(DISTINCT MIN(DISTINCT > MAX(DISTINCT etc might be useful?
I would never put DISTINCT like that. You are crossing Order By functionality as well as where clause over to the uniqueness of Distinct. -- Stephen Russell Sr. Analyst Ring Container Technology Oakland TN 901.246-0159 cell _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAJidMY+-s3cLW8rtMomQUBLHRNhrA09fyuDE7am9_r=x3vg...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

