Hello,
I have a fairly confusing SQL question. I'll explain it as best I can.
I have a table containing a lot of data regarding customers and items they've purchased. A CustomerID can (and does) appear multiple times, as do the ProductIDs. What I'd like to do is run an SQL which will give me results in the following format:
CustomerID ProductID1 ProductID2 ProductID3 ProductID4 ProductID5 ProductID6
Note that each product/customer relationship have one record each, so the SQL is essentially selecting the distinct customerIDs and grouping them, then finding each distinct productID that customer is linked to. Is this possible? So the result set has just one record for each CustomerID?
Any help would be fantastic.
Thanks,
Simon
I have a fairly confusing SQL question. I'll explain it as best I can.
I have a table containing a lot of data regarding customers and items they've purchased. A CustomerID can (and does) appear multiple times, as do the ProductIDs. What I'd like to do is run an SQL which will give me results in the following format:
CustomerID ProductID1 ProductID2 ProductID3 ProductID4 ProductID5 ProductID6
Note that each product/customer relationship have one record each, so the SQL is essentially selecting the distinct customerIDs and grouping them, then finding each distinct productID that customer is linked to. Is this possible? So the result set has just one record for each CustomerID?
Any help would be fantastic.
Thanks,
Simon