You are here: Re: Transposing rows to columns « MsSQL Server « IT news, forums, messages
Re: Transposing rows to columns

Posted by Greg D. Moore \(Strider\) on 07/31/06 11:44

"SakyMoto" <jeroen.tijsen@gmail.com> wrote in message
news:1154344089.525844.305540@s13g2000cwa.googlegroups.com...
> I hope someone can help me with my problem. I have searched the
> internet for days for a solution, but nothing i found seemed to work.
> The following is what i have now:


What version of SQL are you using?

SQL 2005 has a PIVOT commandbuilt in.

Otherwise you can google for some code examples of how to do it in SQL 2000
(it ain't overly pretty.)


>
> appartmentid code
> 100306 Wip
> 100306 Zandbak
> 100306 Glijbaan
> 100306 Klimrek
> 100306 Schommel
> 100321 Glijbaan
> 100321 Schommel
>
> This results are made with this query:
>
> select
> appartment.appartmentid,
> listvalue.code
> from appartment
> inner join appartmentlistvalue on appartmentlistvalue.appartmentid =
> appartment.appartmentid
> inner join listvalue on appartmentlistvalue.listvalueid =
> listvalue.listvalueid
>
> The following is what i need:
>
> 100306 Wip, Zandbak, Glijbaan, Klimrek, Schommel
> 100312 Glijbaan, Schommel
>
> As you can see is this example, not all appartments have the same
> number of results. Can anyone tell me if this is possible?
>
> Many thanks,
> Sakymoto
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация