Export products and variants from SQL Server
Posted
by mickyjtwin
on Stack Overflow
See other posts from Stack Overflow
or by mickyjtwin
Published on 2010-03-09T04:58:06Z
Indexed on
2010/03/09
6:06 UTC
Read the original article
Hit count: 262
I have a SQL Server DB that has a table of products, and another table which contains a list of the sku variants of each product if it has one.
I want to export all the products and their SKU's into excel. At the moment, I have a helper SQL function which performs the subquery against a product_id and concatenates all the SKU's into a comma-delimited string, e.g:
Product Code, Name, SKUs
111 P1 77, 22, 11
Is there an easier way to do this, so that each SKU is a row which the associated product code as well, i.e:
Product Code, Name, SKUs
111 P1 77
111 P1 22
111 P1 11
© Stack Overflow or respective owner