Thursday, September 28, 2017

Dynamics GP - SQL View - Receipt PO Numbers for posted and unposted receipts


/** This view will get the min PO number from the posted and unposted receipts
**** Object:  View [dbo].[BI_PORcts]    Script Date: 9/28/2017 10:25:39 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[BI_PORcts]
AS
SELECT        POPRCTNM, PONum
FROM            (SELECT        POPRCTNM, MIN(PONUMBER) AS PONum
                          FROM            dbo.POP30310
                          GROUP BY POPRCTNM
                          UNION
                          SELECT        POPRCTNM, MIN(PONUMBER) AS PONum
                          FROM            dbo.POP10310
                          GROUP BY POPRCTNM) AS RctPO

GO


No comments:

Post a Comment