On Thu, Sep 30, 2010 at 9:36 PM, Vincenzo Romano <
vincenzo.rom...@notorand.it> wrote:

> 2010/9/30 Raymond O'Donnell <r...@iol.ie>:
> > On 30/09/2010 12:17, Ben Carbery wrote:
> > Googling on "sql swap rows columns" found this:
> >
> >
> http://stackoverflow.com/questions/584232/t-sql-how-to-swap-rows-and-columns
> >
> > ...which you'll be able to adapt.
>
> We also have the fantastic crosstab in tablefunc module (see chapter
> F.36.1.4 for v9.0.0)
>
> --
> Vincenzo Romano at NotOrAnd Information Technologies
> Software Hardware Networking Training Support Security
> --
> NON QVIETIS MARIBVS NAVTA PERITVS
>


..but these seem to be more pivot table functions that alter the data,
rather than displaying it differently. Not sure if this method is adaptable
but I may have a go.

To me swapping would be better suited as an option to psql. After all,
calling columns 'columns' in sql is aribtrary - they could just as easily
have been called rows or something else, so there's no reason for the output
to be fixed that way. Although that would chew a lot of memory if you have a
lot of records as you would need to read every record before formatting..and
I guess that explains why it hasn't been done.

No idea if this can be done in other clients!

Reply via email to