Re: Return rows as 1 line?
From: steph <stephan0h_at_yahoo.de>
Date: Wed, 19 May 2010 06:06:02 -0700 (PDT)
Message-ID: <8f4db16d-e81c-4daa-a89a-fdcdbc244a81_at_s41g2000vba.googlegroups.com>
On 17 Mai, 22:17, The Magnet <a..._at_unsu.com> wrote:
> Hi,
>
> Ok, I am hoping this is now going to be nuts, but say I have data like
> this:
>
> ID PRODUCT SKU
> 1 ABC 123
> 1 DEF 456
> 2 XYZ 000
> 2 MNO 999
> 3 GHI 888
>
> And this is what I would need:
>
> 1,ABC:123,DEF:456
> 2,XYZ:000,MNO:999
> 3,GHI:888
>
> So, records that have a certain criteria would have certain columns
> concatenated. I'm thinking of putting together a dynamic query and
> then opening a cursor and selecting from it, creating the string as I
> go along.
>
> Any thoughts? I'm going to go with the dynamic cursor unless someone
> else has a better idea.
Date: Wed, 19 May 2010 06:06:02 -0700 (PDT)
Message-ID: <8f4db16d-e81c-4daa-a89a-fdcdbc244a81_at_s41g2000vba.googlegroups.com>
On 17 Mai, 22:17, The Magnet <a..._at_unsu.com> wrote:
> Hi,
>
> Ok, I am hoping this is now going to be nuts, but say I have data like
> this:
>
> ID PRODUCT SKU
> 1 ABC 123
> 1 DEF 456
> 2 XYZ 000
> 2 MNO 999
> 3 GHI 888
>
> And this is what I would need:
>
> 1,ABC:123,DEF:456
> 2,XYZ:000,MNO:999
> 3,GHI:888
>
> So, records that have a certain criteria would have certain columns
> concatenated. I'm thinking of putting together a dynamic query and
> then opening a cursor and selecting from it, creating the string as I
> go along.
>
> Any thoughts? I'm going to go with the dynamic cursor unless someone
> else has a better idea.
Maybe something like this helps:
http://www.sqlsnippets.com/en/topic-11591.html
Received on Wed May 19 2010 - 08:06:02 CDT