This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posting the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.
This script was created for a client to use in an external system to verify vendor/document number combinations.
CREATE VIEW [dbo].[uv_AZRCRV_VendorDocumentNumberLookup] AS
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
SELECT
DISTINCT *
FROM
(
SELECT
VENDORID
,VNDDOCNM AS DOCNUMBR
FROM
POP10300 --Purchasing Receipt Work (POP10300)
WHERE
POPTYPE = 2
UNION ALL
SELECT
VENDORID
,VNDDOCNM AS DOCNUMBR
FROM
POP30300 --Purchasing Receipt History (POP30300)
WHERE
POPTYPE = 2
UNION ALL
SELECT
VENDORID
,DOCNUMBR
FROM
PM00400 --PM Key Master File (PM00400)
) AS TRX
GO