Hi
I am struggling with putting a Command together for use in a report.
I have a table containing CRM records with fields for CRM Record ID, Customer Account, CRM Date Created, CRM Reason etc. This table has multiple records for each Customer Account.
I am trying to create a single command that will return only the last created CRM record for each Customer Account that can then be used in a report with other tables (I'm not attempting to bring all required tables in to a single command as I probably should).
I have managed to get the required records by using two commands, one to return all CRM fields / records required for the report with an Inner Join to a second command using the GROUP by Customer Account & Max(CRM Record ID) using the CRM Record ID as the joined fields. However the performance of this setup is very slow
I think I need to be creating single command that includes a sub query but am struggling to take this concept any further.
Does anyone have any pointers for me please?
Thanks
Jon