This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted 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 who had implemented Extended Pricing using Table IMport. The Table Import tool ia very powerful, but also very risky.
Unfortunately, when the client imported the data they had some duplicate lines in the import into the Extended Pricing Price Sheet Work (IV10401) table; this script identified which price sheet/item combinations were duplicated, so that we could then determine which price sheet/item combinations we needed to work to correct.
/*
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 ITEMCOUNT.PRCSHID
FROM
(
SELECT
PRCSHID
,ITEMNMBR
,SUM(1) AS ITEMCOUNT
FROM
IV10401
GROUP BY
PRCSHID
,ITEMNMBR
) AS ITEMCOUNT
WHERE
ITEMCOUNT.ITEMCOUNT > 1