Skip to content

Instantly share code, notes, and snippets.

@MPJHorner
Created May 20, 2016 09:54
Show Gist options
  • Save MPJHorner/f1e541253bfd2ab70436f020d9a88e4b to your computer and use it in GitHub Desktop.
Save MPJHorner/f1e541253bfd2ab70436f020d9a88e4b to your computer and use it in GitHub Desktop.
Find Pricelist Duplicates Report - Khaos Control (Keystone Software)
SELECT
sd.compclass_id as 'Pricelist ID',
cc.short_desc as 'Pricelist',
UPPER(st.stock_code) as 'SKU'
FROM struc_discounts AS sd
LEFT JOIN stock as st
ON sd.stock_id = st.stock_id
LEFT JOIN company_class as cc
on cc.compclass_id = sd.compclass_id
GROUP BY
sd.compclass_id,
cc.short_desc,
st.stock_code
HAVING (count(st.stock_code) > 1 )
ORDER BY
sd.compclass_id,
st.stock_code
asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment