Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Multiple categories in same row

Author  Topic 

yoder
Starting Member

6 Posts

Posted - 2007-04-20 : 15:13:22
Hello folks,

I've been pounding on this for a while, after countless searching I have to break down and ask for help.

I have a table set up like so:

+-----+------------+---------------+------------+
| id | title | path | category |
+-----+------------+---------------+------------+
| 1 | Firemen | firemen.pdf | CGL |
| 2 | Garages | garages.pdf | E&O |
| 3 | Auto | autos.pdf | EPLI |
| 4 | Garages | garages.pdf | CGL |
| 5 | Houses | houses.pdf | E&O |
+-----+------------+---------------+------------+



If there's a title that has more than one category (Garages for example), I would like to be able to show both categories in the same row.

Like so:

Title: Firemen
Path: firemen.pdf
Cat: CGL

Title: Garages
Path: garages.pdf
Cat: E&O, CGL

Title: Auto
Path: autos.pdf
Cat: EPLI


I assume that it might be a better set up if the category was a separate table, but I was hoping there is a way around it. I've tried grouping and subqueries but can't seem to get anything to work.

If someone could steer me in the right direction, it would greatly be appreciated. Thanks much and happy Friday!

Erik

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-21 : 01:02:49
see http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx


KH

Go to Top of Page

yoder
Starting Member

6 Posts

Posted - 2007-04-21 : 17:12:54
Thanks khtan,

Good read. I ended up finding a solution with ASP that didn't end up too bulky.

Anyway, I appreciate the help!

Erik

Go to Top of Page
   

- Advertisement -