Query Regarding Date/Time

hi!
I have data in below mention form and i want to find only those records which are between "4/3/2009 16:53" and "4/7/2009 12:02". Please share select Query ?
---- bellow records are in date format
4/3/2009 16:49
4/3/2009 16:53
4/3/2009 17:39
4/7/2009 12:02
4/7/2009 12:03
4/8/2009 12:30
4/9/2009 11:33
DB 10g (10.2040) on unix-ita
regards

Thanks for your response. Problem have resolved. --irfan ahmad                                                                                                                                                                                                   

Similar Messages

  • Error when trying to restrict query by Date/Time

    I'm running the following Power Query
    let
    ParamTable = Excel.CurrentWorkbook(){[Name="tbl_Parameter"]}[Content],
    StartDateRow = Table.SelectRows(ParamTable, each ([Parameter]="Start Date")), //Find row with Start Date, returns a table
    StartDate = StartDateRow{0}[Value], //Only 1 row in Table so assume row 0 is the value I want
    EndDateRow = Table.SelectRows(ParamTable, each ([Parameter]="End Date")),
    EndDate = EndDateRow{0}[Value],
    Source = Excel.CurrentWorkbook(){[Name="SAMPLE_Excerpt"]}[Content],
    #"Filtered Rows" = Table.SelectRows(Source, each [SAMPLED_DATE] >= StartDate and [SAMPLED_DATE] <= EndDate),
    #"Removed Duplicates" = Table.Distinct(#"Filtered Rows", {"PRODUCT"}),
    Products = Table.SelectColumns(#"Removed Duplicates",{"PRODUCT"})
    in
    Products
    The query returns the correct list but always has an extra error row with the following error message
    Expression.Error: Cannot apply operator < to types DateTime and Number.
    Details:
        Operator=<
        Left=1/1/2015 12:00:00 AM
        Right=42013
    42013 corresponds to 1/9/2015 which is not a date entered anywhere in my query or spreadsheet.  I tried using the DATETIME#() function to convert a text string to a date but still get the same message.
    Can anyone provide an example of restricting a query by a date range pulled from a parameter table in Excel?

    Hi,
    I think this errors due to different date and date time format . So that, you can correct the formula line of StartDate and EndDate to below :
    StartDate = DateTime.From( StartDateRow{0}[Value] )EndDate = DateTime.From( EndDateRow{0} [Value] )
    I hope this to help you.
    Regards,

  • " Query regarding Data transfer from Bi to BO Tool "

    Dear Friends,
                       I am having a query. I have  created a Info-cube and established the universe on the top of the Info-cube.The Dat is coming in the Bi system. When I created a new Webi-report the Data from the ino-cube in the universe is not reflecting the Webi-report .
                         Can anyone tell me the solution for the Data Load in the Webi-report .

    Hi,
    There are two ways to design universe on top of cube/Query.
    1)Olap Universe :Please go through by below link for how to create mdx universe.by this way create one connection and select cube or query and by default designer will replicate cube/query in the universe.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/903a7fc7-19e8-2d10-fa95-b050de946b61?quicklink=index&overridelayout=true
    2) Create Data federator project on top of Cube and then design universe.
    To pull data in the webi report create universe then  select objects and run the query.If data is available in the cube or query that will come in the webi report.
    I have already said webi report pull data at run time.there is no need or no way to load data in the universe or webi.
    Design a universe and create  webi or deski report on top of universe.
    For more information you can search on net can be found documents how to create report.
    Hope this helps you.
    Thanks,
    Amit

  • SQL query for date & time interval

    Hello everyone,
    there is my problem
    I have to make a search for events that are taking place during inserted date & time .
    There's the table structure:
    event
    datefrom
    dateto
    timefrom
    timeto
    The problem is, when I try:
    select * from xyz where datefrom <= inserted_date and dateto >= inserted_date and timefrom <= inserted_time and timeto >= inserted time;
    then I don't get back all records.
    eg: user inserts date = 10.10.2010 and time 10:00 and in the table is event [abc 11:00 9.10.2010 -> 09:00 11.10.2010] stored following way:
    event         abdc
    datefrom   09.10.2010
    dateto        11.10.2010
    timefrom    11:00
    timeto         09:00
    => this event won't be found, because the sql logic compares only single parameters and not their context.
    Do you have any idea, how to solve this issue?
    Thank you.
    Lukas

    Hello Hubert,
    thank you very much for your proposal, but your code makes the same select as mine (but in a more user friendly look :).
    Table:
    datefrom 09.10.2010
    dateto 11.10.2010
    timefrom 11:00
    timeto 09:00
    Event date = 10.10.2010 and time 10:00.
    Your query:
    select * from xyz where 10.10.2010 between 09.10.2010 and 11.10.2010 (that's so far ok) and 10:00 between 11:00 and 9:00 (no return there, because 10:00 doesn't lie within interval 11:00 -> 9:00... actually no value lies there) ;
    Don't you have any other idea?
    Thank you
    Lukas

  • SQL Query for date/time

    Hi All,
    I have a table containing data like this
    Person_name Time_spent Date/time
    ABC 5.5 16-sep-10 12:00
    ABC 3 16-sep-10 05:30
    ABC 2.5 17-sep-10 12:00
    ABC .5 16-sep-10 09:00
    What I want is to get data like this
    Person_name Time_spent Date/time
    ABC 9 16-sep-10
    ABC 2.5 17-sep-10
    what query i should run?
    Thanx
    Omy

    a query like this ...
    select sum(time_spent), person_name, trunc(date_time) from <table_name>
    group by person_name, trunc(date_time);
    HTH.

  • Displaying the Last Query Refresh date/time

    Hello,
    on a Webi report, is there a way to display the date/time that the underlying info provider was refreshed?
    Thanks,
    Nikhi

    1.- Create Formula in Query (columns - Create Formula)
    2.- Create Formula Variable for this Formula (Type Customer EXIT) as individual and optional.
    3.- Define the code for customer exits for variables.
    *-- To get Timestamp for last load of data to cube
    WHEN 'ZLSTLOADDT'.
    DATA: lt_tab_1 TYPE TABLE OF rsdcubemulti,
          ls_tab_1 TYPE rsdcubemulti,
          lt_tab_2 TYPE TABLE OF rsmonicdp,
          ls_tab_2 TYPE rsmonicdp.
    DATA: l_calday   TYPE d,
          l_time     TYPE sy-uzeit,
          l_tzone    TYPE ttzz-tzone,
          l_string   TYPE char20.
          SELECT * FROM rsdcubemulti INTO TABLE lt_tab_1
                  WHERE infocube = i_s_cob_pro-infoprov
                    AND objvers = 'A'.
          SORT lt_tab_1 DESCENDING.
          CLEAR ls_tab_1.
          READ TABLE lt_tab_1 INTO ls_tab_1 INDEX 1.
          REFRESH lt_tab_2.
          SELECT * FROM rsmonicdp INTO TABLE lt_tab_2
                  WHERE icube = ls_tab_1-partcube.
          SORT lt_tab_2 DESCENDING.
          CLEAR ls_tab_2.
          READ TABLE lt_tab_2 INTO ls_tab_2 INDEX 1.
          l_tzone = 'INDIA'. "CET, UTC...
          CONVERT TIME STAMP ls_tab_2-timestamp TIME ZONE l_tzone
                     INTO DATE l_calday "aaaammdd
                          TIME l_time.  "hhmmss
          l_s_range-low = l_calday.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
          EXIT.
        WHEN 'ZLSTLOADTM'.
    DATA: lt_tab_1 TYPE TABLE OF rsdcubemulti,
          ls_tab_1 TYPE rsdcubemulti,
          lt_tab_2 TYPE TABLE OF rsmonicdp,
          ls_tab_2 TYPE rsmonicdp.
    DATA: l_calday   TYPE d,
          l_time     TYPE sy-uzeit,
          l_tzone    TYPE ttzz-tzone,
          l_string   TYPE char20.
          SELECT * FROM rsdcubemulti INTO TABLE lt_tab_1
                  WHERE infocube = i_s_cob_pro-infoprov
                    AND objvers = 'A'.
          SORT lt_tab_1 DESCENDING.
          CLEAR ls_tab_1.
          READ TABLE lt_tab_1 INTO ls_tab_1 INDEX 1.
          REFRESH lt_tab_2.
          SELECT * FROM rsmonicdp INTO TABLE lt_tab_2
                  WHERE icube = ls_tab_1-partcube.
          SORT lt_tab_2 DESCENDING.
          CLEAR ls_tab_2.
          READ TABLE lt_tab_2 INTO ls_tab_2 INDEX 1.
          l_tzone = 'INDIA'. "CET, UTC...
          CONVERT TIME STAMP ls_tab_2-timestamp TIME ZONE l_tzone
                     INTO DATE l_calday "aaaammdd
                          TIME l_time.  "hhmmss
          l_s_range-low = l_time.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
          EXIT.

  • How to query the Date/Time Dataype

    Hi,
    I am trying to query the database with Data/Time Datatype.
    String date=request.getParameter("date");
    String month=request.getParameter("month");
    String year=request.getParameter("year");
    String tosearch=month+"/"+date+"/"+year;
    String getTable="select * from tableRes where dmy='"+tosearch+"'";I would like to know why it is not working?
    I ran through tomcat and it appeared this error:
    Data type mismatch in criteria expression.
    Thanks!

    pramudya81 wrote:
    Rock,
    May I know more detail on your specs?
    What is your DB? Or how is exactly you execute the sql.
    to_date is anyway an Oracle syntax.
    So I guess your DB might be an SQL Server.
    to_date for oracle is equivalent as Convert in SQL Server
    example Select Convert(datetime ,'2002/01/01')
    Hope it works nowBad idea. See reply 1.

  • Query regarding data source creation

    Hi all,
              can u plz tell me that what is the use of real time tab in extraction while creating datasource in BI 7.0?

    Hi Neha,
    If you want to get the data in a smaller intervals from the source then we will be go for this option, i.e, the data which is available in the source system till last minute will be available in the BI system for analysis purpose..
    For more information, please go thru the link below:
    http://help.sap.com/saphelp_nw04s/helpdata/en/52/777e403566c65de10000000a155106/frameset.htm
    Post back incase if you are not clear..
    Regards
    Gattu

  • Query with Date & TIME

    Dear All,
    I need to retreive data between date and time for which here is my where clause, which is not retreiving any data.
    WHERE TRUNC(M.MR_DATE) BETWEEN :START_DATE AND :END_DATE
    AND TO_CHAR(M.MR_DATE, 'HH24:MI') BETWEEN '23:00' AND '07:00'
    Please help.
    Thanks
    Ahon
    Please note: if I make the "time format" in reverse it is showing data:
    WHERE TRUNC(M.MR_DATE) BETWEEN :START_DATE AND :END_DATE
    AND TO_CHAR(M.MR_DATE, 'HH24:MI') BETWEEN '07:00' AND '23:00'

    Thanks everyone,
    to get the result I change the query something like below but it is showing same line item 2 times for each query which is correct, is there any way to bring them into one line.
    SELECT D.DIV_ID, D.GRP_ID, D.ITM_ID, SUM(D.SENT_QTY)QTY, SUM(NVL(D.ITEM_TOT,0))GROSS, SUM(NVL(D.ITEM_COVRG,0))COVER,
    SUM(NVL(D.TRAN_AMOUNT,0))CASH
    FROM INV.SELL_OUT_DOCS M, INV.SELL_OUT_LINES D
    WHERE TRUNC(M.MR_DATE) BETWEEN '20-FEB-2010' AND '20-FEB-2010'
    AND TO_CHAR(M.MR_DATE, 'HH24:MI') BETWEEN '23:00' AND '24:00'
    AND (M.MR_SERIAL=D.MR_SERIAL)
    GROUP BY D.DIV_ID, D.GRP_ID, D.ITM_ID
    UNION
    SELECT D.DIV_ID, D.GRP_ID, D.ITM_ID, SUM(D.SENT_QTY)QTY, SUM(NVL(D.ITEM_TOT,0))GROSS, SUM(NVL(D.ITEM_COVRG,0))COVER,
    SUM(NVL(D.TRAN_AMOUNT,0))CASH
    FROM INV.SELL_OUT_DOCS M, INV.SELL_OUT_LINES D
    WHERE TRUNC(M.MR_DATE) BETWEEN '20-FEB-2010' AND '20-FEB-2010'
    AND TO_CHAR(M.MR_DATE, 'HH24:MI') BETWEEN '00:01' AND '07:00'
    AND (M.MR_SERIAL=D.MR_SERIAL)
    GROUP BY D.DIV_ID, D.GRP_ID, D.ITM_ID
    ORDER BY GRP_ID,ITM_ID
    result is something like this
    P CNS 2709 (DIV_ID, GRP_ID, ITM_ID) 1 (QTY)
    P CNS 2709 (DIV_ID, GRP_ID, ITM_ID) 3 (QTY)
    Thanks for the help
    Ahon

  • Query regarding data extraction

    Hello All,
    I am new to ABAP development. I have been assigned to work on a report, where I have to fetch data for a SC, which will be extracted into an flat file.
    Now my requirement is as below:
    Each shopping cart will have a number of different records. The records are of the following types
    Header – Marked with record type = “HEAD”
    Line item – Marked with record type = ”ITEM”
    Accounting line – Marked with record type = ”ACC”
    Approval record – Marked with record type = ”APP”
    Now in this manner I have to fetch the data in an single flat file. Now I am really confused how I am going to do it. I have the tables for header, item, accounting line, approval records. Now my question is am I have to 1st fetch data for header then line then accounts and approval then join this into my final internal table?? Is this the correct approach?
    I am a beginner and your help will be highly appreciated.  
    I have attached a flat file for your reference.
    Regards,
    Sarnava

    So long as you have some unique identifier between each of these tables this shouldn't be a problem. I of course can't see what data you have in the tables but lets say for example you have an account number, then you can create your flat file something like this:
    head,account123,headfield1,headfield2... etc
    item,account123,itemfld1,itemdfld2,....etc
    item,account123,itemfld1,itemdfld2,....etc
    then the same logic of course for the other two lines i.e. the first part of the line is a field which contains "head" or "item" or "acc" or "app", then the unique identifier and then the rest of the records. And you can make it comma seperated or whatever you want. The user picking this up can then also sort it.

  • Query Regarding Data transfer ( Pls Respond Quickly)

    Hi,
    I need to download the data to XML file. I have hard coded the file path in the Report Program. This Report should be shceduled for every night.
    But the problem is that since I have hard coded the path, whenever the program is deployed to production system there will be a problem regarding the file path.
    Can any body throw some light on how to avoid hard coding of the filepath ?
    Reward points are assured.
    Best  Regards
    Bhagat.

    Hey Kishan,
    In that Program the file path was hard coded. Can you let me know the alternate way so that I can avoid hard coding.
    The thing is that that report should be scheduled  for every night.
    Best Regards
    Bhagat.

  • Query regarding data loading from xls

    Hi
    I want to read data ( integers , only one column) from xls file. I donot want to load it in a table otherwise I could have tried using loader. But what I need to do is I have lakhs of rows in excel sheet and I need to pick them up in a query . I cannot create a table also as working on production . I s there any way I can pick it directly from the excel sheet as I it large volume and I cannot keep them in ( in.. clause) also .

    I want to read data ( integers , only one column)
    from xls file. I donot want to load it in a table
    otherwise I could have tried using loader. But what
    I need to do is I have lakhs of rows in excel sheet
    and I need to pick them up in a query . I cannot
    create a table also as working on production . I s
    there any way I can pick it directly from the excel
    sheet as I it large volume and I cannot keep them
    in ( in.. clause) also .Lakhs of rows!!!! You do realise that an excel spreadsheet is limited to 65536 rows? I'm right in thinking 1lakh = 100000 aren't I?

  • Query regarding date

    hello to all
    guy's in a form i m having an item i.e refdate now i want to work it like this
    that i can insert date data in ddmmyy form and when i press tab or move to other item my date should come in the
    dd/mm/yyyy format in refdate item
    plz help me out ....
    Edited by: Navdeep Kaur on Jul 27, 2009 10:08 PM

    Navdeep,
    I wrote DD/MM/RRRR not DD/MM/YYYY. If you use RRRR instead of YYYY, then the user can enter 2 digit year, and it will automatically convert to 4 digit year.
    Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Query regarding Date Function

    All,
    Can I know the difference between the following two queries
    select TO_CHAR(TRUNC(sysdate),'dd-mon-rr') from dual;
    select TO_CHAR(TRUNC(sysdate),'dd-mon-yy') from dual;
    However, both the query gives the same result as '03-nov-09'.
    Regards
    ND

    ...of which century?
    SQL> var dt varchar2(10)
    SQL>
    SQL> begin
      2     :dt := '03-11-51';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select TO_CHAR(to_date (:dt, 'dd-mm-rr'),'dd-mon-yyyy') from dual;
    TO_CHAR(TO_DATE(:DT,
    03-nov-1951
    SQL>
    SQL> select TO_CHAR(to_date (:dt, 'dd-mm-yy'),'dd-mon-yyyy') from dual;
    TO_CHAR(TO_DATE(:DT,
    03-nov-2051Don't use a two digit year...

  • Query regarding dates

    Hi,
    Can anybody help me in formualated the single sql query for the follwing :
    find out the no of days between two dates except saturday/sunday.
    Please help,

    look no further - BEST SOLUTION HERE
    its short, it totally nls independent, and it's faster than using a connect by
    select
    trunc(dt2) - trunc(dt1)
       - ( next_day(trunc(dt2)-7,to_char(to_date(6,'j'),'DY')) - next_day(trunc(dt1)-7,to_char(to_date(6,'j'),'DY')) )*2/7
       + 1
       - case to_char(dt2,'Dy','nls_date_language=english') when 'Sat' then 1 else 0 end
       - case to_char(dt1,'Dy','nls_date_language=english') when 'Sun' then 1 else 0 end work_days
    from ...
    examples:
    with t as (
    select sysdate dt1, sysdate+20 dt2 from dual union all
    select sysdate-30 dt1, sysdate+3 dt2 from dual union all
    select sysdate-19 dt1, sysdate dt2 from dual
    select dt1, dt2,
    trunc(dt2) - trunc(dt1)
       - ( next_day(trunc(dt2)-7,to_char(to_date(6,'j'),'DY')) - next_day(trunc(dt1)-7,to_char(to_date(6,'j'),'DY')) )*2/7
       + 1
       - case to_char(dt2,'Dy','nls_date_language=english') when 'Sat' then 1 else 0 end
       - case to_char(dt1,'Dy','nls_date_language=english') when 'Sun' then 1 else 0 end work_days
    from t
    DT1       DT2        WORK_DAYS
    20-MAR-08 09-APR-08         15
    19-FEB-08 23-MAR-08         24
    01-MAR-08 20-MAR-08         14
    3 rows selected.

Maybe you are looking for