You can also add COUNT(*) to your query to see how many rows are duplicated and 
use a HAVING to see just the duplicated rows.

--

rk

-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of 
[email protected]
Sent: Friday, March 30, 2018 12:37 AM
To: [email protected]
Subject: Re: Unexpected results from a group by clause

On 2018-03-29 23:00, Joe Yoder 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


Hi Joe,

Replace the GROUP BY with the ORDER BY clause and it won't drop any 
records.

hth,
--Mike 


_______________________________________________
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/dm5pr10mb12445d29f9a543b310eadae8d2...@dm5pr10mb1244.namprd10.prod.outlook.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.

Reply via email to