Connecting Tech Pros Worldwide Forums | Help | Site Map

Moving rows to columns

Jennifer
Guest
 
Posts: n/a
#1: Jul 20 '05
I've seen this answered a number of times in the group, but now that I
actually need the answer I don't know where to look or what to put in
the search.

The question is this:

I have a query that produces these reults:


Col1 Col2
A B
A C
A D
B A
B C
B D


I would like take the above reults, manipulate them and get these:

Col1 Col2 COl3 Col4
A B C D
B A C D


Right now I've got a loop through a cursor, which is ok. It works,
but I'm worried about it because if I end up with a large table in the
future, the longer it will take to run the query with the curors.

Can someone help me please - point me to previous answers to this
question?

Thanks,
Jennifer

John Bell
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Moving rows to columns


Hi

I would search for crosstab!

Maybe a starter?

http://tinyurl.com/i9mt

John

"Jennifer" <jennifer1970@hotmail.com> wrote in message
news:3358f49d.0310060601.1ca0ebf3@posting.google.c om...[color=blue]
> I've seen this answered a number of times in the group, but now that I
> actually need the answer I don't know where to look or what to put in
> the search.
>
> The question is this:
>
> I have a query that produces these reults:
>
>
> Col1 Col2
> A B
> A C
> A D
> B A
> B C
> B D
>
>
> I would like take the above reults, manipulate them and get these:
>
> Col1 Col2 COl3 Col4
> A B C D
> B A C D
>
>
> Right now I've got a loop through a cursor, which is ok. It works,
> but I'm worried about it because if I end up with a large table in the
> future, the longer it will take to run the query with the curors.
>
> Can someone help me please - point me to previous answers to this
> question?
>
> Thanks,
> Jennifer[/color]


Closed Thread