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 to allow a client to check combinations of account (segment 2) and category combinations to make sure all accounts with those combinations had the same posting type assigned.
/*
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
GL100.ACTNUMBR_2 AS 'Cost Account'
,GL102.ACCATDSC AS 'Category'
,CASE WHEN GL100.PSTNGTYP = 0 THEN
'Balance Sheet'
ELSE
'Profit and Loss'
END AS 'Posting Type'
FROM
GL00100 AS GL100 WITH (NOLOCK) --Breakdown Account Master (GL00100)
INNER JOIN
GL00102 AS GL102 WITH (NOLOCK) --Account Category Master (GL00102)
ON GL102.ACCATNUM = GL100.ACCATNUM