gpt4 book ai didi

Postgresql:在 playframework 1.x 中选择两个日期之间的所有数据

转载 作者:行者123 更新时间:2023-11-29 14:12:18 24 4
gpt4 key购买 nike

我有一个 postgresql 表,其中包含与日期相关的数据。每行都有数据和日期,例如:

2011-02-03    JOHN   Male   etc

I am using playframework. i have created a model named student.java.

and in application.java i have done something like this where firstDate and lastdate are given by user,

List (student studentList) = student.find("timestamp BETWEEN 'firstDate' and 'lastDate'").fetch();

我想获取这两个日期之间的所有数据。

但我知道查询不正确。请帮帮我。

提前致谢。 :)

最佳答案

public static final List<Student> findWithDates(Date firstDate, Date lastDate) {
return find("from Student student where student.date >= ? and student.date <=?",
firstDate, lastDate).fetch();
}

关于Postgresql:在 playframework 1.x 中选择两个日期之间的所有数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12524140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com