On Sun, May 20, 2012 at 8:26 PM, Ken Dibble <[email protected]> wrote:
> I'm interested in whether there is an ANSI SQL standard that > says you're not supposed to be able to have "DISTINCT" after the field > list. 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. Because of the dual use, parsing of DISTINCT is difficult. There are several notes throughout the SQL standard that such parsing is "implementation dependent." So, you're welcome to debate whether that "violates the standard" or not. -- Ted "I love standards, that's why I have so many!" Roche Ted Roche & Associates, LLC http://www.tedroche.com _______________________________________________ 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/CACW6n4vAAzrB5dV9eB=suvzbdxjqfu7mxha-jaggiugl-c+...@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.

