You must Sign In to post a response.
  • Category: SQL Server

    Oracle query between two dates and timing should be between 8 Pm to 5AM

    Please suggest a oracle query between two dates and timing should be between 8 Pm(April1) to 5AM(April2) and group by should come dates

    Select datecolumn1,column2 from table where trunc(datecolumn2) between '09-jan-2019' and 12-feb-2019' group by datecolumn1


    Timing of the rows should be between 8pm to 5am .. how I should add where condition for this
  • #769900
    I could group by using dates.. not sure how to select based on timings

  • #769905
    hi
    you can change like this

    Select datecolumn1,column2 from table where trunc(datecolumn2) between '19-jan-12' and 19-feb-12' group by datecolumn1

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #769909
    @Dotnet developer 2015:
    group by datecolumn1 should come for date alone not timing... Timing has to consider at last once grouping by dates done. ( 12 PM,1AM - 7AM).

    Above query grouping by datetime..

  • #769910
    I have 2 where conditions. first and second part should come in different column

    where column1 between '01' and '06'
    or
    column1 between '07' and '12'

    Commoncolumn column1 column2
    Jan1 01 07
    Jan 2 02 08
    Jan 3 03 09
    Jan4 04 10
    Jan5 05 11
    jan6 06 12

    How this query should come

  • #769912
    Hi

    Can you share your table script with data then mention your output then only i can trace exactly your issue

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments