Friday, March 10, 2017

Dynamics GP - SQL View - SRMaster - Salesperson and Territory


CREATE VIEW [dbo].[BI_SRMaster]
AS
SELECT     dbo.RM00301.SLPRSNID, dbo.RM00303.SALSTERR, dbo.RM00303.SLTERDSC, dbo.RM00301.EMPLOYID, dbo.RM00301.SLPRSNFN, dbo.RM00301.SPRSNSLN,
                      RTRIM(dbo.RM00301.SLPRSNFN) + ' ' + RTRIM(dbo.RM00301.SPRSNSLN) AS SrNm, RTRIM(dbo.RM00301.SLPRSNID) + ' | ' + RTRIM(dbo.RM00301.SALSTERR)
                      + ' | ' + RTRIM(dbo.RM00301.SLPRSNFN) + ' ' + RTRIM(dbo.RM00301.SPRSNSLN) AS SrTerrLbl, dbo.RM00301.STATE, dbo.RM00301.INACTIVE AS SRInactive,
                      dbo.RM00303.INACTIVE AS TerrInactive
FROM         dbo.RM00301 INNER JOIN
                      dbo.RM00303 ON dbo.RM00301.SALSTERR = dbo.RM00303.SALSTERR

GO


No comments:

Post a Comment