Let\'s say I have a Product
, Category
, and Product_To_Category
table. A Product can be in multiple categories.
Product
You can't create these results with a strict SQL query. What you're trying to produce is called a pivot table. Many reporting tools support this sort of behavior, where you would select your product and category, then turn the category into the pivot column.
I believe SQL Server Analysis Services supports functionality like this, too, but I don't have any experience with SSAS.