Search Postgresql Archives

Re: column names query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 7, 2017 at 3:28 PM <hamann.w@xxxxxxxxxxx> wrote:
Example query
select a.col1, case when a.col2 > 0 then a.col3 else b.xcol1 end as mycol3 from a left join b on ....
Expected response
col1 mycol3

This may be overkill, but works:

postgres=# \copy (select 1 as foo, 2 as bar limit 0) to stdout with (format csv, header, delimiter ' ')
foo bar 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux