troubleshooting Question

SQL 2008 - Group Customer Name with Multi-Value in single column

Avatar of allenkent
allenkentFlag for United States of America asked on
Microsoft SQL Server 2008SQL
3 Comments1 Solution38 ViewsLast Modified:
I have a MS SQL view that shows customer names and state - with multiple lines of data of a value named LOT. I wish to combine all the LOT into a single column for each Customer.

Example: (this is sample of my existing SQL View.

CustomerA       CA         Lot123
CustomerA       CA         Lot456
CustomerA       CA         Lot789
CusomterZ        AZ         Lot543
CustomerZ        AZ         Lot919
CustomerV        VA        Lot777

This is what I was trying to get in my view:
CustomerA       CA         Lot123, Lot456, Lot789
CusomterZ        AZ         Lot543, Lot 919
CustomerV        VA        Lot777

This is my statement (that gives all values)
SELECT CUSTOMER,STATE,LOT

FROM dbo.MYSQLTable
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros