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

From: Geoff Muldoon <geoff.muldoon_at_trap.gmail.com>
Date: Mon, 2 May 2016 09:16:09 +1000
Message-ID: <g7i1tfr4y57e.vd7uo8raqmkk$.dlg_at_40tude.net>


On Fri, 29 Apr 2016 05:59:43 -0700 (PDT), smallubotlla_at_gmail.com wrote:

> 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

Cast your (time only data type?) fields to a date/time fields, using current date for the date component, except current date + 1 for shift_end where shift_end time value < shift_start time value.

GM Received on Mon May 02 2016 - 01:16:09 CEST

Original text of this message