On 05/20/12 17:26, Ken Dibble wrote: > I have the ability to grasp that there are multiple implementations of ANSI > SQL standards. Really and truly, despite my preference to focus on Foxpro, > I am aware of the rest of the computer language universe. > > However, right now I'm not using T-SQL (and may never; when I go to a > separate SQL back end it's not likely to be M$ SQL Server). Right now I'm > using Foxpro. 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. Is there? If not, then there's no bug in allowing such usage, in my > opinion.
Hi, Ken Did a little digging (not into the ANSI standard, however. It seems to be about 400 pages!) and came up with the following. T-SQL (MS Sql Server) and MySQL are both very clear - the DISTINCT modifier goes immediately after the 'SELECT' and before the field list. It appears that 'Top n' is a VFP extension/enhancement. In general, the preferred sequence is SELECT [DISTINCT] <fieldlist> FROM ... [JOIN ...] [GROUP BY ...] [ORDER BY ...] I may be old and set in my ways, but I do NOT see being able to vary the sequence of clauses as a good thing. There is nothing to gain by doing it in different ways, and it makes the code harder to maintain. In fact, there is a program to 'clean up' VFP code by (a) expanding the 4-letter 'short commands' and (b) re-shuffling the clauses into the correct order. I view VFP's 'flexibility' more as a case of sloppy syntax checking than as an advantage. YMMV Dan Covill _______________________________________________ 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/[email protected] ** 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.

