Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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? image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago