Question: Up top is the raw data that I have. It gives 4 different businesses and the items they sell are the columns. If a business

Up top is the raw data that I have. It gives 4 different businesses and the items they sell are the columns. If a business sells an item it is designated by a 1, if not a 0. A business can sell one or multiple items.

The bottom is what I am trying to get with my SQL statement. A new column that shows what each business sells with a comma separating them if there is more than one.

I was able to use the CASE statement to return something similar to the bottom but when a business sells more than 1 item it only returns the first item that is typed in the query. For example, if "Food" was typed before "Hardware" in the case statement then the return for Joe's business would just read "Food" and leave off "Hardware". Can someone please help? Up top is the raw data that I have. It gives 4

D B Food Business Bob's Joe's Jims Al's Clothes 0 1 1 0 Hardware 0 1 0 1 0 0 1 0 Business Bob's Joe's Jims Alls What is Sold? Hardware Food, Hardware Food Clothes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!