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?
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 ClothesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started