GROUP BY is intended to GROUP multiple records together so you can calculate MAX(), MIN(), SUM() and similar "aggregate" functions on multiple records and report them in one line.
ORDER BY specifies the ORDER of the resulting recordset. It's just a confusing coincidence that VFP usually reports records that are GROUPed in the correct order. Don't count on that, as it's not part of the SQL standard to do that, and some data engines don't. On Thu, Mar 29, 2018 at 11:00 PM, Joe Yoder <[email protected]> wrote: > I have an SQL select statement that includes a group by clause to order the > output for reporting. It gets its data from a table that potentially > includes legitimate duplicate records. > > SELECT account, date, memo, paid_amoun; > FROM QB; > GROUP BY account, date, memo, paid_amoun; > INTO CURSOR det > > I happened to discover that the output of the select statement does not > include duplicate records. Is this expected behavior? If so , how should > one group data with duplicate records? > > Thanks in advance, > > Joe > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cacw6n4sx76zni-k0t+avzsh5dfikhz1nci5chac8oqhns1z...@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.

