From: "Howard News" <howardnews@selestial.com>Sent: Wednesday, November 30, 2016 9:03:28 AMSubject: Re: [GENERAL] select function aliasOn 30/11/2016 13:42, Timoteo Blanco wrote: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. 3 options:Use the same to_char expression in the where clauseUse a sub-select to use the alias in the outer where clauseUse the original column in the where clause and use the timestamp comparisson functions.
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.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных