Dynamics AX 2009 View: Customer with Salesperson Name

HKFuey
HKFuey used Ask the Experts™
on
I'm trying to extract from AX the above data, does anyone know which tables I need to use and how to link. I do not have access to the AX client only the SQL database.

I'm being told to use CUSTTABLE, EMPLTABLE AND DIREPARTY table but I cannot work out how to link these.

Can anyone help?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
SELECT        TOP (100) PERCENT dbo.CUSTTABLE.ACCOUNTNUM, dbo.DIRPARTYTABLE.NAME AS SalesPersonName, dbo.CUSTTABLE.DATAAREAID, dbo.DIRPARTYTABLE.PARTYID,
                         dbo.EMPLTABLE.EMPLID AS SalesPersonID, dbo.DIRPARTYTABLE.FIRSTNAME, dbo.CUSTGROUP.NAME AS CustGroupName
FROM            dbo.CUSTTABLE INNER JOIN
                         dbo.EMPLTABLE ON dbo.CUSTTABLE.DATAAREAID = dbo.EMPLTABLE.DATAAREAID AND dbo.CUSTTABLE.MAINCONTACTID = dbo.EMPLTABLE.EMPLID INNER JOIN
                         dbo.DIRPARTYTABLE ON dbo.EMPLTABLE.PARTYID = dbo.DIRPARTYTABLE.PARTYID INNER JOIN
                         dbo.CUSTGROUP ON dbo.CUSTTABLE.CUSTGROUP = dbo.CUSTGROUP.CUSTGROUP AND dbo.CUSTTABLE.DATAAREAID = dbo.CUSTGROUP.DATAAREAID
WHERE        (dbo.CUSTTABLE.DATAAREAID = N'XXXX')
ORDER BY ACCOUNTNUM

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial