I am trying to build a query in Slx to show me all of the accounts that had a meeting, and when that last meeting was. So far the closest I have gotten it to work is using this under Historyid with the 'in' operator:
SELECT A3.HISTORYID FROM HISTORY A3 WHERE A3.TYPE = 262145 AND A3.COMPLETEDDATE = (SELECT MAX(A4.COMPLETEDDATE) FROM HISTORY A4 WHERE A4.ACCOUNTID = A3.ACCOUNTID)
For some reason however, hundreds of accounts are excluded and I cannot figure out why. I've even tried using STARTDATE and CREATEDATE and it doesn't seem to change exluding some accounts.
Any ideas what I could do?
|