1800radiatoranalytics of 1-800 Radiator-SQL Codes
7/11/2017 - 5:40 PM

Change the category, this will clean up the "canuse" column, and give you the crossed CUCs in another column that can be used for analysis.

Change the category, this will clean up the "canuse" column, and give you the crossed CUCs in another column that can be used for analysis.

SELECT DISTINCT a.StockCUC ---CUC 
      ,b.StockCatShortName --Category
      ,a.StockCUCCanUse ---- Can Use Column
      ,c.StockCUC as 'CanUseCross' ---Cleaned up Can Use Column
FROM gxwizmo_24.dbo.stockcuc a
      JOIN gxwizmo_24.dbo.stockcategory b
            ON a.StockCatId = b.StockCatId
      LEFT JOIN gxwizmo_24.dbo.STOCKCUC c
            ON a.stockcuccanuse like '%' + c.stockCUC + '%' ----this is doing a join using a like statement. Weeds out the other BS that is in the can use column
            AND a.StockCatId = c.StockCatId ---this restricts your results to the SAME category, which makes the results more accurate
WHERE b.StockCatShortName = 'OS-RAD' ---change category here