Delete based on specific hours for each day

Hello

I have a table with a field of date DD-MM-YYYY HH:MIN:SS
Table contains date since 2006 and I just need to keep the entries with date DD-MM-YYYY 00:00 (midnight only registers for each day)

Thanks in advance for any help.

drbiloukos wrote:

...
...
...
14-JAN-13
14-JAN-13 12:01:00
14-JAN-13 12:01:05
14-JAN-13 12:02:03
14-JAN-13 12:01:55
14-JAN-13 12:02:13
15-JAN-13
15-JAN-13 12:01:00
15-JAN-13 12:01:05
15-JAN-13 12:02:03
15-JAN-13 12:01:55
15-JAN-13 12:02:13
...
...
...

just need to keep accounts with

...
14 JANUARY 13
15 JANUARY 13

LUN-JJ-AA 00:00

that

delete from table where date_col != trunc(date_col);
or to keep the data
update table set date_col = trunc(date_col)

or you can add the new column

alter table table_name add (new_date date);

and update

update table table_name set new_date = TO_DATE(TO_CHAR(old_date,'DD.MM.YYYY HH24:MI')||':00', 'DD.MM.YYYY HH24:MI' )

Published by: Bawer on 16.01.2013 12:03

Tags: Database

Similar Questions

  • Calendar of the apex; limit values for each day/cell

    Apex 4.2

    I'm working on a calendar widget to my page. The calendar will be specific sectors (using the abbreviation of sector space maximze) for each day. When you use the calendar, I noticed the sectors more you have, the cell for this day will begin to stretch down / vertically. I tried to change this so that a specific day / cell would show only a number of areas. For example, maybe one day 20 sectors are attributed to him, however, I only want to show 5 of them and then a text saying 'See more'. The text 'see more' will eventually be a link, but it's far from being the problem.

    Initially, the request for this was along the lines of:

    select
    the_id, the_date, the_sector, the sector_abbrev
    from Table
    where this = that
    

    It would show all sectors for all the days on the calendar. Yet once, I wanted to limit the output every day as some days would indicate all 20 sectors (their abbreviations), and some would be 3 or four in function. So to say that there are 30 sectors (10 1st), 4 of the 15, 12 on 20-4 on November 29. I want to allow only five abbreviations of sector which must appear in a cell until the link "see more" appears. I came up with the following query:

    Select
    the_sector_abbrev, the_id, the_date, the sector
    from Table
    where rownum <= 5 and (this = that)
    union all
    Select 'View More', null, null, null
    from dual
    

    I found that it would be limiting my calendar for showing that four areas throughout the month of November and not for each day / cell on the calendar. I am to discover that 'rownum' is perhaps not the way to go. I don't know how to specify for each of the calendar days rownum. I don't know how to capture every day / the Calendar cell. Maybe I need a more complicated or a subquery where clause. But overall, from my example above, the 1st show four of the sectors and then the link "See more", the 15th would show the four sectors and thats all, the 20th century would show four sectors and her "see more" link and so on.

    Any help on this would be greatly appreciated. Thanks in advance.

    NewApexCoder wrote:

    I had no idea of the possible application of solution would be too complex.

    It is not the case:

    with calendar_data as (
        select
            ins.sector_abbrev_name
          , sch.hwe_inspection_scheduling_id
          , sch.inspection_date
          , sch.instructions
          , sch.inspection_sector_id
          , sch.high_water_event_id
          , ins.inspection_sector_name
          , hwe.event_name
          , row_number()
                over (
                  partition by sch.inspection_date
                  order by sch.inspection_date, ins.inspection_sector_name) day_sector_rn
        from
            hwe_inspection_scheduling sch
              left join inspection_sectors ins
                on sch.inspection_sector_id = ins.inspection_sector_id
              left join high_water_events hwe
                on sch.high_water_event_id = hwe.high_water_event_id
        where
            (   sch.high_water_event_id = :p0_high_water_event_id
             or :p0_high_water_event_id is null))
    select
        inspection_sector_id
      , inspection_date
      , inspection_sector_name
      , sector_abbrev_name
      , ...
      , null -- Generate URL for sector links here
    from
        calendar_data
    where
        day_sector_rn <= 5
    union all
    select
        null
      , trunc(the_date) + 1 - interval '1' second
      , null
      , 'View More…'
      , ...
      , null -- Generate URL for "View More..." links here
    from
        calendar_data
    group by
        the_date
    having
        count(*) > 5
    
  • Is there a specific forum for each tutorial such as the first condition in DW?

    I'm doing the tutorial here: retrieves a Photoshop design into code in Dreamweaver | Adobe Dreamweaver tutorials CC

    I asked how to get the pictures in the tutorial is displayed on my computer, but I can't ask the right question, I guess. I downloaded the files, the unzipped in a folder that is newly formed and named my site, but the pictures of the PS are not displayed.

    So my first question is: Y at - it a specific forum for each DW tutorial as with all prime which has its ' own forum? Here is the link to this forum. Man and style a webpage in Dreamweaver

    Second question is higher on the photos of PS in the first link.

    Thank you

    Deb

    I repeat the advice that has been given over and repeatedly learn DO NOT "Dreamweaver". The door to collaboration successfully with any web development, including Dreamweaver software, is to understand the role of HTML and CSS.

    HTML is still pretty simple. The main thing that happened with HTML5 has been the introduction of some new elements of grouping, such as the header, footer, section, article and so on. Most of them are named intuitively, but you can continue to use the div to group items. What has changed is CSS. She is now much more powerful and has become more difficult to control. Even people like me, who have it used for years, have to learn new things all the time.

    Regarding the suggestion through courses on lynda.com, I'm obviously biased. However, I would advise against the use of lynda.com to learn the basics of Dreamweaver. The main course of Dreamweaver, Dreamweaver CC Essential Trainingis up to date. It will be updated, but not immediately. There are more courses Dreamweaver to update on lynda.com, including my Responsive Design with Bootstrap and Dreamweaver CC 2015and create a site of first with Dreamweaver CC 2105 of Paul Trani. However, they assume a basic knowledge of HTML and CSS.

    For those who have a lynda.com subscription, or plan to get one, first courses, you should look at are HTML Essential Training, Web Design Fundamentalsand basics of CSS. These three courses are taught by James Williamson, who is a brilliant teacher.

    There is, of course, other resources that teach the same basic web development technologies, some free, others paid for. But until you have a good knowledge of HTML and CSS, Dreamweaver will remain a frustrating mystery.

  • Use of user track in buckets of 48 hours for each month

    I have an obligation to follow the use by the user in buckets of 48 hours for each month. For example, from midnight on 1st Oct, create buckets of 48 hours thanks to 23:59 on 31 Oct. For each user, how many times they use the system in each bucket 48 hours? I try to avoid PL/SQL, if I can so right SQL is preferred. Thank you very much in advance for your help.

    Usage_Table (sample data)

    ID User_Name Create_DateTime

    This last 100 10/01/11 00:01:58
    This last 101 01/10/11 01:02:31
    102 user_B 02/10/11 14:44:32
    This last 103 04/10/11 08:21:11
    This last 104 04/10/11 03:10:20
    105 user_B 05/10/11 12:50:30
    106 and user_a 07/10/11 13:45:10
    107 and user_a 07/10/11 18:22:08


    Example of output

    User_name From_DateTime To_DateTime Number_Of_System_Uses
    This last 10/01/11 00:00:00 02/10/11 23:59:59 2
    user_A 03/10/11 00:00:00 04/10/11 23:59:59 2
    user_B 10/01/11 00:00:00 02/10/11 23:59:59 1
    user_B 10/04/11 00:00:00 05/10/11 23:59:59 1
    and user_a 10/06/11 00:00:00 07/10/11 23:59:59 2

    Hello

    JoeCO wrote:
    ... I tried the outer join, but did not see the number 0. I'll keep playing with it.

    Sorry, my mistake. It was not nearly as simple as I said earlier. JOIN EXTERNAL means that all ranks of the cntr will appear in the result set at least once, but we need every line of cntr appear joining each month and user_name at least once, we can do with a partitioned outer join:

    WITH     cntr     AS
    (
         SELECT     2 * (LEVEL - 1) AS low_val
         ,     2 *  LEVEL     AS high_val
         FROM     dual
    --     CONNECT BY     LEVEL     <= 16     -- Max buckets in any month
         CONNECT BY     LEVEL     <=  4     -- For testing only
    )
    ,     got_month_start     AS
    (
         SELECT     user_name
         ,     create_datetime
         ,     TRUNC (create_datetime, 'MONTH')     AS month_start
         FROM     t_usage
    )
    SELECT       u.user_name
    ,       u.month_start + c.low_val     AS bucket_start_date
    ,       u.month_start + c.low_val
                   + 2
                   - (1 / (24 * 60 * 60))
                             AS bucket_end_date
    ,       COUNT (u.create_datetime)     AS number_of_system_uses
    FROM             cntr            c
    LEFT OUTER JOIN      got_month_start  u  PARTITION BY ( u.user_name
                                    , u.month_start
                                    )
                             ON  ( u.create_datetime
                                 - u.month_start
                                 )     BETWEEN     c.low_val
                                  AND     c.high_val
    GROUP BY  u.user_name
    ,       u.month_start
    ,       c.low_val
    ORDER BY  u.user_name
    ,       bucket_start_date
    ;
    

    As you can see, I also moved the calculation of TRUNC (create_datetime, 'MONTH') in a subquery.
    I only showed the frist 4 buckets, just to simplify somewhat the exit during the original trial. The result is:

    `                                              NUMBER
                                                     _OF_
                                                   SYSTEM
    USER_N BUCKET_START_DATE   BUCKET_END_DATE      _USES
    ------ ------------------- ------------------- ------
    user_A 10/01/2011 00:00:00 10/02/2011 23:59:59      2
    user_A 10/03/2011 00:00:00 10/04/2011 23:59:59      2
    user_A 10/05/2011 00:00:00 10/06/2011 23:59:59      0
    user_A 10/07/2011 00:00:00 10/08/2011 23:59:59      0
    
    user_B 10/01/2011 00:00:00 10/02/2011 23:59:59      1
    user_B 10/03/2011 00:00:00 10/04/2011 23:59:59      0
    user_B 10/05/2011 00:00:00 10/06/2011 23:59:59      1
    user_B 10/07/2011 00:00:00 10/08/2011 23:59:59      0
    
    user_C 10/01/2011 00:00:00 10/02/2011 23:59:59      0
    user_C 10/03/2011 00:00:00 10/04/2011 23:59:59      0
    user_C 10/05/2011 00:00:00 10/06/2011 23:59:59      0
    user_C 10/07/2011 00:00:00 10/08/2011 23:59:59      2
    
  • I need a query that selects the amount of records for each day of a table.

    I need a query that selects the amount of records for each day of a table.
    For example, the result would be:

    1 14 date
    Date 2-3

    etc.

    Any ideas?

    Sort:

    SELECT count ([IDCommentaire]), convert (varchar, dateAdded, 112)

    OF COMMENTSgroup by convert (varchar, dateAdded, 112)

  • Select the last value for each day of the table

    Hello!

    I have a table that contains several measures for each day. I need two queries on this table, and I'm not sure how to write them.

    The table stores the rows (sample data)
    *DateCol1                 Value       Database*
    27.09.2009 12:00:00       100           DB1
    27.09.2009 20:00:00       150           DB1
    27.09.2009 12:00:00       1000          DB2
    27.09.2009 20:00:00       1100          DB2
    28.09.2009 12:00:00       200           DB1
    28.09.2009 20:00:00       220           DB1
    28.09.2009 12:00:00       1500          DB2
    28.09.2009 20:00:00       2000          DB2
    Explanation of the data in the sample table:
    We measure the size of the data files belonging to each database to one or more times a day. The value column indicates the size of the files of database for each database at some point (date in DateCol1 European model).


    What I need:
    Query 1:
    The query must return to the last action for each day and the database. Like this:
    *DateCol1       Value      Database*
    27.09.2009        150          DB1
    27.09.2009       1100          DB2
    28.09.2009        220          DB1
    28.09.2009       2000          DB2
    Query 2:
    The query should return the average measurement for each day and the database. Like this:
    *DateCol1       Value      Database*
    27.09.2009       125          DB1
    27.09.2009      1050          DB2
    28.09.2009       210          DB1
    28.09.2009      1750          DB2
    Could someone please help me to write these two queries?

    Please let me know if you need further information.

    Published by: user7066552 on September 29, 2009 10:17

    Published by: user7066552 on September 29, 2009 10:17

    Why two queries when it suffice ;)

    SQL> select dt
      2       , db
      3       , val
      4       , avg_val
      5    from (
      6  select dt
      7       , val
      8       , db
      9       , row_number () over (partition by db, trunc (dt)
     10                                 order by dt desc
     11                            ) rn
     12       , avg (val) over (partition by db, trunc (dt)) avg_val
     13    from test)
     14   where rn = 1
     15  order by dt
     16  /
    
    DT        DB           VAL    AVG_VAL
    --------- ----- ---------- ----------
    27-SEP-09 DB2         1100       1050
    27-SEP-09 DB1          150        125
    28-SEP-09 DB2         2000       1750
    28-SEP-09 DB1          220        210
    
  • The opportunity to identify a specific storage for each user or security group.

    Hi all

    I asked how to specify storage for each user or security group on the server of the University Complutense of Madrid. ex. I want user 'weblogic' unable to download a document on the server of the University Complutense of Madrid, more than a gigabyte. the user can check in several files, but thetotal space for all files are not a gigabyte.

    Thank you

    I asked how to specify storage for each user or security group on the server of the University Complutense of Madrid. ex. I want user 'weblogic' unable to download a document on the server of the University Complutense of Madrid, more than a gigabyte. the user can check in several files and the total space for all files not exceeding a gigabyte.

    You can write a rule to achieve this where in the xStorageRule is evaluated based on any set of metadata such as dDocAuthor or dDocSecurityGroup etc., or a combination of metadata.

  • Cumulative total for each day - how to deal with nulls

    I'm on 11.2.0.3.  I want to write a query to calculate a running total of the incidents a day - this request will be used for an APEX line chart.


    Sample table and data:

    create table sales (
      id number primary key,
      time_of_sale date,
      item varchar2(20));
    
    
    insert into sales values (1, to_date('02-JAN-2013','DD-MON-YYYY'), 'book');
    insert into sales values (2, to_date('03-JAN-2013','DD-MON-YYYY'), 'candle');
    insert into sales values (3, to_date('05-JAN-2013','DD-MON-YYYY'), 'bicycle');
    insert into sales values (4, to_date('05-JAN-2013','DD-MON-YYYY'), 'football');
    insert into sales values (5, to_date('07-JAN-2013','DD-MON-YYYY'), 'football');
    insert into sales values (6, to_date('10-JAN-2013','DD-MON-YYYY'), 'elephant');
    insert into sales values (7, to_date('10-JAN-2013','DD-MON-YYYY'), 'turtle');
    insert into sales values (8, to_date('10-JAN-2013','DD-MON-YYYY'), 'book');
    insert into sales values (9, to_date('10-JAN-2013','DD-MON-YYYY'), 'candle');
    insert into sales values (10, to_date('10-JAN-2013','DD-MON-YYYY'), 'bicycle');
    commit;
    

    For each of the days between 1 January and 10 Jan I want to get the total functioning of the number of sales.

    So the output l would like is:

    DAY ITEMS_PER_DAY

    --------- -------------

    1ST JANUARY 13 0

    JANUARY 2, 13 1

    JANUARY 3, 13 2

    JANUARY 4, 13 2

    5 JANUARY 13 4

    JANUARY 6, 13 4

    JANUARY 7, 13 5

    JANUARY 8, 13 5

    JANUARY 9, 13 5

    10 JANUARY 13 10

    So even if there is no sale on January 4, we show the total of the previous day.

    If I can create a series of dates using the:

    select trunc((to_date('01-JAN-2013','DD-MON-YYYY')-1) + rownum) day 
    from dual 
    connect by rownum <= 10
    

    And I can't the cumulative aid total:

    select trunc(time_of_sale) as day, sum(count(*)) over (order by trunc(time_of_sale)) as items_per_day
    from sales
    group by trunc(time_of_sale)
    

    Overall, it gives me:

    SQL > select

    2 a.day as the day,

    3 b.items_per_day

    4 of

    5 (select trunc((to_date('01-JAN-2013','DD-MON-YYYY')-1) + rownum) as day

    6 double

    7 plug by rownum < = 10).

    8 (select trunc (time_of_sale) day, sum (count (*)) (trunc (time_of_sale) order) as items_per_day

    9 sales

    10 group by trunc (time_of_sale)) b

    11 where a.day = b.day [+] - replace by parentheses to avoid the formatting of the forum

    12 order by a.day

    13.

    DAY ITEMS_PER_DAY

    --------- -------------

    1st January 13 null

    JANUARY 2, 13 1

    JANUARY 3, 13 2

    Value null 4 January 13

    5 JANUARY 13 4

    Value null January 6, 13

    JANUARY 7, 13 5

    Value null January 8, 13

    Value null January 9, 13

    10 JANUARY 13 10

    It's not exactly what I'm looking for.  I played a bit with a lag, but had no success.

    Any ideas?

    Thank you

    John

    Hi, John,.

    You want to do the SUM after the outer join, like this:

    WITH days_wanted AS

    (

    SELECT TO_DATE (January 1, 2013 ', 'DD-MON-YYYY') + ROWNUM - 1 day YOU

    OF the double

    CONNECT BY ROWNUM<=>

    )

    SELECT d.day

    SUM (COUNT (s.id)) OVER (ORDER BY d.day) AS items_to_date

    OF days_wanted d

    S sale LEFT OUTER JOIN ON TRUNC (s.time_of_sale) = d.day

    GROUP BY d.day

    ORDER BY d.day

    ;

    Note that we must use COUNT (s.id) instead of COUNT (*) here, because, given that it is evaluated once the outer join, COUNT (*) would be taken into account less than $ 1 a day, because the outer join ensures there will be at least 1 row in the game for each row in days_wanted, whether or not it matches anything in sales.

    It wouldn't work using the old join syntax, too, but I suggest to use the ANSI syntax, especially for outer joins.  It reduces the amount and the complexity of the coding, and which allows to reduce the number of errors.  (Also, it avoids the problem of the display of this site.)

  • Download all dates for each day of a week

    I need a VI that gives me the dates of the week. I use a calendar month to look at a database and fill two different graphs with the database values. A chart looks at the values of the specific day, I chose in the calendar, but the other graph looks like all the days of the week. To create this SQL query, I need to have all the dates this week.

    I could build a function if I knew that the first and last date of the week. Anyone know an easy way to do this?

    Use the Second to primitive time to convert your day to a cluster of time. One of the elements of the cluster is the day of the week that should allow you to easily find the end of the week (you can add 2 days and convert back or add 2 with the unit of the timestamp of origin).

  • Select specific lines for each employee ID

    Dear all seniors
    I'm tired of getting correct result my. I have the following query
    CHOOSE EI. EMP_CODE, MIN (TO_CHAR (ei.intime, 'DD-MON-RR')) IN_DATE
    OF hcm.einout ei, hcm.personnel p
    WHERE EMPLOYMENT INSURANCE. EMP_CODE = P.EMP_CODE
    AND P.EMP_TYPE = '04' AND P.EMP_STATUS IN ('01 ', ' 03')
    AND TRUNC (ei.intime)
    BETWEEN TO_DATE (APRIL 1, 12 ', 'DD-MON-RR')
    AND TO_DATE (APRIL 30, 12 ', 'DD-MON-RR')
    AND TO_NUMBER (TO_CHAR (ei.intime, 'sssss'))
    BETWEEN TO_NUMBER (TO_CHAR (TO_DATE (' 09:16 ',' HH24 '), 'sssss'))
    AND TO_NUMBER (TO_CHAR (TO_DATE (' 11:59 ',' HH24 '), 'sssss'))
    GROUP BY ei.emp_code, TO_CHAR (ei.intime, 'DD-MON-RR')
    ORDER BY 2 desc, ei.emp_code

    the result of this query is the following
    Emp_code IN_DATE
    149 21 April 12
    149 April 19, 12
    149 18 April 12
    149 17 April 12
    149 16 April 12
    149 15 April 12
    149 April 14, 12
    149 13 April 12
    149 12 April 12
    149 11 April 12
    149 April 9, 12
    149 April 8, 12
    149 April 7, 12
    149 April 2, 12
    149 1st April 12
    Total = 15/3(5--need to select for emp_code 149)
    174 29 April 12
    174 19 April 12
    174 15 April 12
    178 28 April 12
    178 27 April 12
    178 26 April 12
    178 25 April 12
    total = 7/3(2--need to select for emp_code 174)
    -I mean firstly I'll count all in_date of each employee, then I divide on 3 What is the result after the division only as no need to select lines. Please tell me how is solve.

    Try this example...

    select emp_code, in_date
    from (select a.*,row_number() over(order by in_date desc) rn from emp_late_intime a)
    where rn<(select max(cnt)
              from (select round(count(*) over(order by in_date desc)/3) cnt
              from emp_late_intime))
    order by emp_code,in_date;
    

    Hope this helps

  • Is there a paper which would give a specific time for each website visit - revisit a website via the history seems to adapt the list?

    I am disputing the exact time that I visited a site Web - but because I revisited the sit by searching in history & clicking through the appearance of the new visit seems to replace the old in history.

    Hello, try the tool view historical mozilla : http://www.nirsoft.net/utils/mozilla_history_view.html

  • How to count the records for each region day and conditional

    Hello

    I need to create a report where I list activities for a month and the number of specific Type for each days activities. something like below

    Number of days in the month where Type = 'A' Count where Type = B
    January 1, 2009 2 3
    January 2, 2009 7 6
    January 3, 2009 8 7
    ----

    -----
    January 31, 2009 4 6

    I tried with the creation of conditional region for each row of table for every day, but it does not work. I use below for conditional region-

    <? xdofx:If substr (to_date ('20': substr (Planned, 9, 2) |)) » -'|| substr (Planned, 1, 2). » -'|| (substr (Planned, 4, 2), 'MM-DD-YYYY'), 4, 2) = 01? > <? Planned? > <? end if? >
    But it is not functional and do not know how to count records in the table for each date as well.

    Can anyone help in it as soon as possible. I'm quite new to BI.

    Thnks

    You can mark it as resolved... :D

    Kind regards
    Colectionaru

  • SQL - last selection query save values for each date in term

    Hello

    Can anyone help me please with my problem.

    I'm trying to get the last balance recorded for each day of specific box (1 or 2) in a given period of days of the database ms access using ADOTool.

    I'm trying to get this information with SQL query but so far without success.

    My table looks like this:

    Name of the table: TestTable

    Date         Time      Location  Box  Balance
    20.10.2014.  06:00:00     1       1    345
    20.10.2014.  12:00:00     1       1    7356
    20.10.2014.  18:45:00     1       1    5678
    20.10.2014.  23:54:00     1       1    9845
    20.10.2014.  06:00:02     1       2    35
    20.10.2014.  12:00:04     1       2    756
    20.10.2014.  18:45:06     1       2    578
    20.10.2014.  23:54:10     1       2    845
    21.10.2014.  06:00:00     1       1    34
    21.10.2014.  12:05:03     1       1    5789
    21.10.2014.  15:00:34     1       1    1237
    21.10.2014.  06:00:00     1       2    374
    21.10.2014.  12:05:03     1       2    54789
    21.10.2014.  15:00:34     1       2    13237
    22.10.2014.  06:00:00     1       1    8562
    22.10.2014.  10:00:00     1       1    1234
    22.10.2014.  17:03:45     1       1    3415
    22.10.2014.  22:00:00     1       1    6742
    22.10.2014.  06:00:05     1       2    562
    22.10.2014.  10:00:16     1       2    123
    22.10.2014.  17:03:50     1       2    415
    22.10.2014.  22:00:10     1       2    642
    23.10.2014.  06:00:00     1       1    9876
    23.10.2014.  09:13:00     1       1    223
    23.10.2014.  13:50:17     1       1    7768
    23.10.2014.  19:47:40     1       1    3456
    23.10.2014.  21:30:00     1       1    789
    23.10.2014.  23:57:12     1       1    25
    23.10.2014.  06:00:07     1       2    976
    23.10.2014.  09:13:45     1       2    223
    23.10.2014.  13:50:40     1       2    78
    23.10.2014.  19:47:55     1       2    346
    23.10.2014.  21:30:03     1       2    89
    23.10.2014.  23:57:18     1       2    25
    24.10.2014.  06:00:55     1       1    346
    24.10.2014.  12:30:22     1       1    8329
    24.10.2014.  23:50:19     1       1    2225
    24.10.2014.  06:01:00     1       2    3546
    24.10.2014.  12:30:26     1       2    89
    24.10.2014.  23:51:10     1       2    25
    ...
    

    Let's say that the period is 21.10.2014. -23.10.2014. and I want to get the last balance recorded for zone 1. for each day. The result should look like this:

    Date         Time      Location  Box  Balance
    21.10.2014.  15:00:34     1       1    1237
    22.10.2014.  22:00:00     1       1    6742
    23.10.2014.  23:57:12     1       1    25
    

    So far, I managed to write a query that gives me the balance so that a SINGLE date (date more time in the table), but I need balance for EACH date in a specific period.

    My incorrect code (has not managed to implement "BETWEEN" for the dates...):

    SELECT TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
    FROM TestTable
    WHERE Time=(SELECT MAX(Time)
    FROM TestTable
    WHERE Location=1 AND Box=1 );
    

    TNX!

    NP

    Here's the correct query (just copy - paste):

    SELECT
    T1.Date,
    T1.Time,
    T1.Location,
    T1.Box,
    T1.Balance
    FROM TestTable T1
    INNER JOIN (
    SELECT
    MAX(Time) AS Max_Time
    FROM TestTable
    WHERE Location=1 AND Box=1 AND Date BETWEEN #10/27/2014# AND #11/1/2014#
    GROUP BY Date) T2
    ON T1.Time=T2.Max_Time;
    

    The problem is in the SELECTION within the INNER JOIN. This SELECTION selects the time max for each date, because we want this and then the entire table, we choose filelds we want, but now we have only fields with the time max.

    Here is a really good explanation of INNER JOIN if anyone is interested--> JOINT INTERNAL

    Peace!

  • Need for each week of grouping on a date column

    Hi, I have the following query

    Select user_name 'user who accessed '.

    , count (user_name), "number of accessible times.

    of apex_workspace_access_log

    where application_id = 123

    and TRUNC (access_date) BETWEEN to_date (1 July 2013 00:00:01 "," dd-mon-yyyy hh24:mi:ss') and to_date (4 August 2013 23:59:59 ',' dd-mon-yyyy hh24:mi:ss') Group of user_name,.

    At the moment it displays the data for each day from July 1, 2013. I need to view the data in my application a week... We hear that he should consolidate the meter and the username per week.

    as from July 1 to July 7, July 8-14 July, 15 July-21 July, 22 July to 28 July, 29 July - 4 August and so on.

    Could you please let me know if we can do this via the query?

    which can be achieved by putting Manik query as a point of view online by using the function command Rank by the number of the week.

    Select user_name (user_name) count, rank() (command per week CSA) week from (SELECT user_name 'User who has consulted',

    COUNT (user_name) 'number of times accessed.

    TO_CHAR (access_Date, 'IW') week

    Of apex_workspace_access_log

    WHERE application_id = 123

    AND TRUNC (access_date) BETWEEN TO_DATE (1 July 2013 00:00:01 ',)

    "hh24:mi:ss mon-dd-yyyy")

    AND TO_DATE (4 AUGUST 2013 23:59:59 ',)

    "hh24:mi:ss mon-dd-yyyy")

    GROUP BY user_name,to_char(access_date,'IW')

    );

    PS: He completely untested, but I guess it would help you to get the numbers of the week as well.

  • I heard that we might try Lightroom for free for 30 days, once I wanted to try it but the download was so long that at the time he was downloading I changed my mind and stopped the download and delete each 'part' of the application. Now, I want to try it

    I heard that we might try Lightroom for free for 30 days, once I wanted to try it but the download was so long that at the time he was downloading I changed my mind and stopped the download and delete each 'part' of the application. I now want to try it finally but it says I can she... Is it possible to understand? I don't want it before trying it...

    Please check: software Adobe to trial has expired at the beginning

Maybe you are looking for