Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张桌子,假设我们有
ID | NAME | Time -------------------- 3 | ex | 15:22:00
从此表中,我想选择时间介于 14:30:00 和提前两个小时 (16:30:00) 之间的行,因此应选择行 ID 3。
使用Java最好的方法是什么?
SELECT * FROM table WHERE TIME(Time) BETWEEN "14:30:00" AND "16:30:00";
我无法对其进行测试,所以如果它不能完全发挥作用,我很抱歉。
至于在java中正确的做法,给我们更多的细节。您使用的是 JDBC、JPA 还是其他?