select function alias

From: Timoteo Blanco <timoteorblanco(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: select function alias
Date: 2016-11-30 13:42:20
Message-ID: CAOTyrk8f2UyNG+ptpgxb8_te3mQ-ibin-W9ss1WNd82157gz+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Howdy,

I've a series of timestamp columns I'd like to alias in select statements.
psql indicates my alias doesnt exist after
I define it.

Example -> select to_char(impressions_create_date,'yyyy-mm-dd') as ymd from
impressionsdb where ymd like '2016-11%' ;

psql always complains column ymd does not exist. I've inherited a series of
tables with many timestamps and would like to
shorten the select in queries without renaming any columns.

postgresql 9.2 on Gentoo 4.4.26

TIA, TRB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2016-11-30 13:43:22 Re: About the MONEY type
Previous Message Karsten Hilbert 2016-11-30 13:33:05 Re: Verify Option with pg_dump