MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:harm Date:July 11 2003 2:24pm
Subject:Re: columns to rows
View as plain text  
On Sat, Jul 12, 2003 at 01:11:41AM +1000, Phil Evans wrote:
> Hi there. I am a rank amateur at this trying to make sense out of a heap (and
> growing) of data.
> 
> I have a resultset with this structure:
> 
> no    data    date
> 1    uyt    d1
> 1    klh    d2
> 1    oiu    d3
> 2    kjh    d1
> 2    kljh    d2
> 2    asd    d3
> 
> that I wish to convert to this structure.
> 
> no     d1    d2    d3
> 1     uyt    klh    oiu
> 2     kjh    kljh   asd 

something like:
select no.no, d1.data, d2.data, d3.data from no, data as d1, data as d2, data
as d3 where no.no = d1.no and no.no = d2.no and no.no = d3.no order by
no.no;

Good luck,

Harmen


> 
> Given that the original has over 100,000 records, I was hoping to find some
> reasonable way of doing it.
> 
> Thanking you,
> 
> PhilE
> 

-- 
                                The Moon is Waxing Gibbous (93% of Full)
                                             tty.nl - 2dehands.nl: 83414
Thread
columns to rowsPhil Evans11 Jul
  • Re: columns to rowsharm11 Jul
    • Re: columns to rowsEmile State11 Jul
  • Re: columns to rowsVictoria Reznichenko11 Jul
RE: columns to rowsRudy Metzger14 Jul