Re: SQL lite query for get the records in which current time range exist between range of time slots

From: Jerry Stuckle <jstucklex_at_attglobal.net>
Date: Fri, 29 Apr 2016 10:26:24 -0400
Message-ID: <nfvqo0$fg1$2_at_jstuckle.eternal-september.org>


On 4/29/2016 10:12 AM, Stefan Ram wrote:

> smallubotlla_at_gmail.com writes:

>> The requirement is to get the time slot from sql table with
>> the help of current time . Here is the table below . The
>> problem arises when i am trying to get the time slot that
>> surpasses 24th hours for example like the Night shift . if my
>> current time is 21:00 i am unable to get the time slot .
>> query made so far
>> SELECT
>> *,CURRENT_TIME
>> FROM
>> tbl_shift
>> WHERE CURRENT_TIME BETWEEN shift_start
>> AND shift_end
>> shift_id shift_name shift_start shift_end
>> -------- ---------- ----------- -----------
>> 1 Morning 09:00:00 13:00:00
>> 2 Evening 13:00:00 16:15:00
>> 3 Night 16:01:00 09:00:00
> 
>   I don't have SQL lite handy, so I tried it with MySQL.
> 
>   You don't need to use a procedure. The procedure below is
>   just there to try it out. The actual SELECT statement used
>   can be found in the procedure. It can be used without the
>   procedure.
> 

<snip>

I've seen more convoluted junk, but not much!

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex_at_attglobal.net
==================
Received on Fri Apr 29 2016 - 16:26:24 CEST

Original text of this message