View Single Post

   
  #4 (permalink)  
Old 02-29-2008, 05:55 AM
Andy O'Neill
 
Posts: n/a
Default Re: sql query syntax

"Yaron" <yaroni@gmail.com> wrote in message
news:1107267206.063304.159240@z14g2000cwz.googlegr oups.com...
> Hi all,
> I have the following tables:
>
> T1
> ==
> ID Name
> -- ----
> 1 Name1
> 2 Name2
> T2
> ==
> ID Color
> -- ----
> 1 Color1
> 1 Color2
> 2 Color2
> 2 Color3
>
> and I would like to get the following output (without duplicates):
>
> ID Colors
> -- ------
> 1 Color1, Color2
> 2 Color2, Color3
>
> Is it possible?
>


You could possibly do this in sql by two unioned queries.
I've done this when I want 12 months data cross tabbed/pivotted in a crystal
report.

It'll get really messy really quickly if you have some with >2 colours
though.

I'd imagine the pivot stuff in sql 2005 might make this rather easier.

--
Regards,
Andy O'Neill


Reply With Quote