hello guys,
how can i select from table with a given time then select the nearest time available
sample select * from mytable where Time=10:00, i want to get the nearest time
ID | Time
1 09:00
2 13:00
3 15:00

What do you mean by nearest .
What is the parameter of nearest
1 min
30 min
1 hr
2 hr
.....
....
What you want ?

What do you mean by nearest .
What is the parameter of nearest
1 min
30 min
1 hr
2 hr
.....
....
What you want ?

sample i have a table consisting the following data
ID TIME
1 08:00
2 09:00
3 11:00
4 14:00
5 15:00

when i query from this table, i want to find the nearest or closest time to my given time
sample select * from mytable where mytime 08:30 then get the closest time available

Thats what i asked . How much closer to the input time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.