如何从现在到当前日期结束之间提取数据? Postgres

how I can extract data between now and the end of the current date? Postgres

我需要提取从现在到当前日期结束的最后一百个电话

ejm:

select * from call where create_at between >= yyyy-mm-dd 00:00:00 and <= yyyy-mm-dd 23:59:59 limit 100

如何提取这个范围内的数据?

当前日期,意思是今天?

SELECT * from call
  WHERE create_at BETWEEN 'today' AND 'tomorrow'
  LIMIT 100

如前所述,您可能还想对它们进行排序,逻辑上向后排序会给出最后的 100

SELECT * from call
  WHERE create_at BETWEEN 'today' AND 'tomorrow'
  ORDER BY create_at desc
  LIMIT 100

你也提到了"from now",所以如果你不想要已经过去的时间,你可以使用(有或没有订单)

SELECT * from call
  WHERE create_at BETWEEN now() AND 'tomorrow'
  LIMIT 100