Using SQL server 2012 and office 365 excel; I have the following example data in a table:
Columns: pd_code, height,width,length, pd_catdesc, Category
Data example: derp,1,1,1,derp desc, cattop>>catmain>>catsub___18
the total rows when i select from my table is 10976, if i take out category and group by all other columns i get 10691 (correct unique parts).
Reason
A product can have more than 1 category. The issue I face is for an import. A product has a category defined like...
category___18;
If I want to add multi i need to simply add a semi colon
category___18; category___20;
From the data as you can see my category field is actually the tree, i have some excel code that rids me of all but the sub category. Excel code
=TRIM(RIGHT(SUBSTITUTE(CR3,">>",REPT(" ",250)),250))
category___18;
What I need
what I need to do to the data is to filter out those multi catgeory products. so I can do a bulk import of single category products.
then I need to do a new query that somehow will take all the sub categorys for a product and create a string like
category___18;category___20;
Summary
So I need to only return unique rows based on pd_code but contain a column that will display a subcategory like
cat___18;
And any other categorys like
cat___18;cat___19;