Khaled
Khaled

Reputation: 8583

SQLite: Select rows with time in range

I have a table where let's say we have

  ID  |  NAME  |  Time
  --------------------
   3  |  ex    |  15:22:00

From this table I want to select the rows that have time that is between Time 14:30:00, and two hours ahead (16:30:00) so row id 3 should be selected.

What is the best way to do it, using Java?

Upvotes: 0

Views: 180

Answers (1)

Cristina_eGold
Cristina_eGold

Reputation: 1553

SELECT * FROM table WHERE TIME(Time) BETWEEN "14:30:00" AND "16:30:00";

I'm not able to test it, so I'm sorry if it's not fully functional.

As for the right way to do it in java, give us more details. Are you using JDBC, JPA, some other?

Upvotes: 1

Related Questions