如何在Vertica中使用where语句查询时间戳列

3
我正在使用Vertica DB,并希望查询类似以下的内容:
select count(*) from users where  create_ts ='2015-04-17 05:01:02'

在这里,create_ts是时间戳。我查询得到的计数是零,尽管我有很多记录。

2个回答

1

从日期部分到秒钟,您可以使用以下内容:

select count(*) from users where  date(create_ts) ='2015-04-17 05:01:02'

没有日期函数的话,你需要具体到最详细的级别。

1
时间戳的精度高于一秒钟。尝试使用间隔:
select count(*)
from users
where create_ts >= '2015-04-17 05:01:02' and
      create_ts < '2015-04-17 05:01:03';

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接