Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3132

Re: Command to retrieve only Max records for a Grouped field

$
0
0

Ok, this is more of a SQL question than a Crystal question.  However, be sure you read my blog to understand why you should NOT be joining multiple commands.  http://scn.sap.com/community/crystal-reports/blog/2015/04/01/best-practices-when-using-commands-with-crystal-reports.

 

Now, here's the logic you'll need to follow to get what you need:

 

Select <all of the fields for the report>

from <CRM table> as crm

  <joins to other tables>

  inner join (

    select CustomerAccountField, max(CRM.CRMRecordID)

    from CRMTable

    where <various criteria as needed>  <-- Optional

    group by CustomerAccountField

  ) as maxRec

  on crm.CRMRecordID = maxRec.CRMRecordID

where <filter criteria>

-Dell


Viewing all articles
Browse latest Browse all 3132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>