如何使用AS关键字从转换后的日期列中进行查询

时间:2018-09-20 19:55:07

标签: select presto

这给我一个错误Column 'new_date' cannot be resolved

    SELECT from_iso8601_date(substr(timestamp,1,10)) AS new_date 
    FROM "db_name"."table_name" 
    WHERE new_date > from_iso8601('2018-08-26') limit 10;

这也给了我同样的错误:

SELECT * 
FROM (SELECT from_iso8601_date(substr(timestamp,1,10)) FROM "db_name"."table_name") AS new_date
WHERE new_date > from_iso8601('2018-08-26') limit 10;

1 个答案:

答案 0 :(得分:1)

我能够确定为

select *
from 
(
  SELECT from_iso8601_date(substr(timestamp,1,10)) as day,*
  FROM "db"."table"
 )
WHERE  day > date_parse('2018-08-26', '%Y-%m-%d')  
 limit 10