Grouping SQL

I need to see each customer in one row, in other words all items related to a customer should be in one row group by Cust# , please help. Thanks.

Cust#         Customer      age      Item1      Item2      Item3       Item4
123                  John               50          tea                  
456                 Smith               40                    apple            
789                  Tom              35                                                  milk
123                  John               50                                  orange      
123                 John              50                   apple            
789                Tom               35                                orange      
456               Smith              40         tea                  
123      John                      50                                                    milk
Capture.PNG
Abdul KhanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Simple approach would be to use GROUP BY..
SELECT Cust#, Customer, age, MAX(Item1) Item1, MAX(Item2) Item2, MAX(Item3) Item3, MAX(Item4) Item4
FROM ur_table
GROUP BY Cust#, Customer, age

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Abdul KhanAuthor Commented:
Thanks so much Raja!!
0
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Welcome, glad to assist..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.