Hi i have a view structured something like this :
id catname productname
1 aa prod1
1 bb prod2
1 aa prod1
1 bb prod2
2 cc prod3
2 dd prod4
2 cc prod3
2 dd prod4
i need to insert to another table so the result will look like this :
id data
1 aa bb prod1 prod2
2 cc dd prod3 prod4
what is the best way to approach this?
currently i am using a complicated code with cursurs that does ont realy wo
rk
and i feel is not in the right direction i hope there is a knowen solution
for this problem
thanks
shay cohen> what is the best way to approach this?
Doing it in your client app / reporting tool or programming language.
AMB
"Shay" wrote:
> Hi i have a view structured something like this :
> id catname productname
> 1 aa prod1
> 1 bb prod2
> 1 aa prod1
> 1 bb prod2
> 2 cc prod3
> 2 dd prod4
> 2 cc prod3
> 2 dd prod4
> i need to insert to another table so the result will look like this :
> id data
> 1 aa bb prod1 prod2
> 2 cc dd prod3 prod4
>
> what is the best way to approach this?
> currently i am using a complicated code with cursurs that does ont realy
work
> and i feel is not in the right direction i hope there is a knowen solution
> for this problem
> thanks
> shay cohen
>|||What you want is a cross-tab or pivot table see the following url:
http://msdn.microsoft.com/library/d...r />
_04j7.asp|||"patrick_brisbine" <patrickbrisbine@.hotmail.com> wrote in message news:<1107464600.631695.3
6160@.c13g2000cwb.googlegroups.com>...
> What you want is a cross-tab or pivot table see the following url:
> http://msdn.microsoft.com/library/d...4j7.
asp
thanks,
this looks like a good start, now what if need to do string
manipulation
on each value so aa is XXaa and prod1 is FFprod1 etc,all values need
to go in to one target colume and the number of columns in the view
can change ?
thanks alot for you time and attention
shay
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment