How to sum colmn for evey day in the month

All if i have a table that has
username, volume, date
And i want to sum the volume for everyday of the month, does anyone have an example.

hehe, losing my head by using analytics when they're not needed... ooops!
SQL> with t as (select 'USERA' as username, to_date('01/01/2007','DD/MM/YYYY') as dt, 1 as vol FROM DUAL UNION ALL
  2             select 'USERA', to_date('01/01/2007','DD/MM/YYYY'), 2 FROM DUAL UNION ALL
  3             select 'USERB', to_date('01/01/2007','DD/MM/YYYY'), 4 FROM DUAL UNION ALL
  4             select 'USERB', to_date('01/01/2007','DD/MM/YYYY'), 8 FROM DUAL UNION ALL
  5             select 'USERC', to_date('03/01/2007','DD/MM/YYYY'), 16 FROM DUAL UNION ALL
  6             select 'USERD', to_date('01/01/2007','DD/MM/YYYY'), 32 FROM DUAL UNION ALL
  7             select 'USERA', to_date('02/01/2007','DD/MM/YYYY'), 64 FROM DUAL UNION ALL
  8             select 'USERB', to_date('01/01/2007','DD/MM/YYYY'), 128 FROM DUAL UNION ALL
  9             select 'USERC', to_date('03/01/2007','DD/MM/YYYY'), 256 FROM DUAL UNION ALL
10             select 'USERA', to_date('02/01/2007','DD/MM/YYYY'), 512 FROM DUAL UNION ALL
11             select 'USERD', to_date('01/01/2007','DD/MM/YYYY'), 127 FROM DUAL UNION ALL
12             select 'USERA', to_date('03/01/2007','DD/MM/YYYY'), 31 FROM DUAL)
13  -- END OF TEST DATA
14  select username, dt, sum(vol)
15  from t
16  group by username, dt
17  order by 1,2
18  /
USERN DT                    SUM(VOL)
USERA 01/01/2007 00:00:00          3
USERA 02/01/2007 00:00:00        576
USERA 03/01/2007 00:00:00         31
USERB 01/01/2007 00:00:00        140
USERC 03/01/2007 00:00:00        272
USERD 01/01/2007 00:00:00        159
6 rows selected.

Similar Messages

  • How can i view appointments for a day in the monthly calendar

    how can i view appointments for a singol day in the monthly calendar?
    Thank you

    It's a problem they need to fix. Make a complaint at http://www.apple.com/feedback/

  • Update statement for modifying day of the month

    Hi,
    i hope there is an easy answer to a question i'm probably over thinking. i have a situation where i need to update all the days in a date field to a certain day of the month regardless of the month or year. Here is an example of a small number of dates in the table:
    07/28/2004
    04/21/2008
    12/21/2011
    08/21/2006
    04/04/2008
    04/16/2012
    08/13/2011
    03/01/2006
    04/17/2012
    So, for each of these dates the day (or DD) would need to be converted to the 15th (ie. 07/15/2004, 04/15/2008, 12/15/2011, etc). I've used to_char to pull out just the DD, but am unsure what the update statement would need to look like. Any assistance would be greatly appreciated. Thank you!

    If you don't care about the time component
    UPDATE your_table
       SET your_column = trunc(your_column,'MM') + 14Justin
    Edited by: Justin Cave on Apr 26, 2012 9:47 PM
    Off by 1. Should be +14 not +15

  • ICal - How do I create a Last Day of the Month event?

    The old trick to change .ics file with RRULE:FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=-1 does not work in iCal 4.0.4.
    How would I do it now?

    Thank you so much, captfred, for your quick reply!
    You are absolutely right that this option is now available in iCal. I am ashamed that I was not aware of it.
    Also, I had misunderstood the instructions on https://discussions.apple.com/message/9044726?messageID=9044726. In fact, if I follow the instructions correctly, the old trick still works. Of course, it is a moot point now because, as you pointed out, it can be done in the usual GUI.
    Thanks again!

  • Schedule Executed weekly except for a specific day of the month

    Hi all,
    I need to create a schedule that run weekly every sunday at 9 PM, except for 2nd day of the month it will run at 7 AM.
    I have created 2 schedules:
    1. One to run weekly every sunday at 9 PM, but i don't know from where i can specify the days of the month the schedule will be inactive on it.
    * I have tried By Month Day option, and choose all days of the month except second day of the month to run on it.
    FREQ=WEEKLY; BYMONTHDAY=1,3,4,5,..,31; BYDAY= SUN; BYHOUR=21;
    But, on the schedule preview window as i have designed the schedule from oracle warehouse builder, shows sunday, 02, July for example.
    as an execution date for this schedule.
    which is not appropriate.
    2. Another job is created to run monthly on the 2nd day of the month,
    FREQ=MONTHLY; BYMONTHDAY=2; BYDAY= SUN; BYHOUR=7;
    So, please advice how to create schedules daily or weekly and neglect some days of month from it.

    Hi,
    You can use the exclude clause introduced in 10gR2 for this by creating a schedule when your job should not run and excluding it. An example is given below.
    Hope this helps,
    Ravi.
    create or replace procedure print_schedule_dates
       schedule in varchar2,
       start_date in timestamp with time zone default dbms_scheduler.stime(),
       number_of_dates in pls_integer default 10
    is
      date_after timestamp with time zone := start_date - interval '1' second;
      next_date timestamp with time zone;
    begin
      for i in 1 .. number_of_dates
      loop
        dbms_scheduler.evaluate_calendar_string
         (schedule, start_date, date_after, next_date);
        dbms_output.put_line(to_char(next_date,
                        'DY DD-MON-YYYY (DDD-IW) HH24:MI:SS TZH:TZM TZR'));
        date_after := next_date;
      end loop;
    end;
    begin
      dbms_scheduler.create_schedule('monthday2',
        repeat_interval=>'freq=monthly;bymonthday=2');
    end;
    exec print_schedule_dates('FREQ=WEEKLY;BYDAY=SUN;BYHOUR=21;exclude=monthday2',sysdate+1,30);
    exec print_schedule_dates('FREQ=WEEKLY;BYDAY=SUN;BYHOUR=21',sysdate+1,30);

  • Variable to show ALL days of the month

    I have a data provider that looks like this:
    OID Name Occurence
    1 Lemons 20/10/2009
    2 Apples 21/10/2009
    3 Pearss 24/10/2009
    4 Lemons 20/10/2009
    5 Apples 21/10/2009
    I want produce a cross tab that INCLUDES the count for each day of the month even if an occurence has not happened on that date:
    Date 01/10 through to 30/10
    Lemons
    Apples
    Pears
    er how do I do this?

    Joe,
    Insert an extra dataprovider for all the days in the month with a dummy value. You can then add that dummy value in your
    crosstab and hide it.
    Cheers,
    Harry
    PS,
    Please post your mesage only once instead of 2 or 3 times.

  • How do I add a recurring event to repeat on the fifth recurring day of the month, for example, an event that only happen on the fifth Sunday of the month for those months that have a fifth Sunday?

    How do I add a recurring event to repeat on the fifth recurring day of the month, for example, an event that only happen on the fifth Sunday of the month for those months that have a fifth Sunday?

    Create one on the first Tuesday, select repeat/monthly and take the option at the bottom.

  • How to undelete history for 1 day?

    I need to know how to undelete history for 1 day.

    You can try to restore the places.sqlite file via the Time Machine to a version from before deleting that history.
    *http://www.apple.com/support/timemachine/
    You can use this button to go to the Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *https://support.mozilla.org/kb/Recovering+important+data+from+an+old+profile
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • How do I set a recurring event for the last day of the month on iphone 4s calendar?

    I want to set a recurring event for the last day of every month - regardless of the date/number of days in the month. I'd prefer not to have to use an app to do this.

    Hi,
    You can do this using the custom repeat in iCal. You'll need two events to cover the second and fourth Mondays.
    Create the event on the second Monday of the month. In Repeat select Custom... > Frequency: Monthly > On the: second Monday.
    Do the same for the Fourth Monday.
    Best wishes
    John M

  • BIP eBusiness Suite Dates - How to include the last day of the month?

    How can I get my report to include the last day of the month 'without' forcing my users to enter the non-intuitive first of the next month as a parm?
    I have a report that will generally be run for a month but can be run for any pair of dates representing the first and last date to be included in the report.
    When we pass the dates from Oracle Apps to the report it is truncating the date to midnight. This results in the last date entered 'NOT' being included in the report as the second date is marked as "midnight". When I attempt to simply add "=1" to the end date it fails due to formatting issues in apps (only). I have gotten this to work on our Enterprise edition server that we use for testing (only) but it fails in our apps environment.
    In APPs we input the date in the format "01-AUG-2007", and this is how it shows in the parm line before the report is submitted as well as in the "View Details" after the report is executed: http://home.swbell.net/grog1//work/req_details_5607586.jpg
    However it is odd in that we in the "View Log" entry it shows the date formatted as "2007/08/01 00:00:00": http://home.swbell.net/grog1/work/view_log_5607586.jpg
    Even odder is that under diagnostics, "View XML" the date is formatted third way as: "2007/08/01 00:00:00.0" (note it now includes tenths of a second): http://home.swbell.net/grog1/work/view_xml_5607586.jpg
    This of course makes it difficult to perform conversions and calculations on the date in the SQL.
    Is APPs doing some sort of 'timestamp' conversion?
    How can I get my report to include the last day of the month 'without' forcing my users to enter the non-intuitive first of the next month as a parm?
    Any feedback is appreciated,
    Scott

    No. The problem/error occurs long before the data is formatted into xml for presentation to the format template.
    The error occurs in the SQL in the 'data' template when I attempt to add a day to the date. It either does not like the implicit conversion with the "+1" and then the use of the "between" with another date or if I attempt to manually convert it has problems with the format mask.
    Scott

  • Date for first day of current month

    How can i get the date for first day of current month ?

    select trunc(sysdate,'MM'),to_char(trunc(sysdate,'MM'),'DD'),to_char(trunc(sysdate,'MM'),'Day') from dual;

  • How to find the last 4th business day of the month (not include weekend)

    Hi,
    I need help how to code the ABAP program to locate the last 4th business day of the month (not include Satuday, Sunday and holidays).
    For example for the last 4th business day in 2008 are:
    1/28/2008,
    2/26/2008
    3/26/2008
    4/25/2008
    5/27/2008
    6/25/2008
    7/28/2008
    8/26/2008
    9/25/2008
    10/28/2008
    11/21/2008
    12/26/2008
    Thank you so much!
    Helen

    Hello Helen
    I would use a two-step approach:
    (1) Set date to the first of day of month (e.g. 20080201 = 01.02.2008)
    (2) Subtract four working days from this date
    If I remember correctly there is a function group BKK available which contains fm's for adding workdays to a given date (search for 'BKKWORKDAY). To subtract a number of working days use a negative number.
    See also: [BKK_GET_MONTH_LASTDAY|reg :BKK_GET_MONTH_LASTDAY;
    Regards
      Uwe

  • How to create appointment occurs last day of each month

    Hi Preston,
    I am trying to create a monthly recurring appointment occurs on last day of every month in .Net. E.g. start at May 31, 2010 end at May 31 2011 every month.
    I specified the frequency as monthly, byMonthDay[0] = (sbyte)31. But this only generates the instances on those months contain the 31th day. My question is how to also create instances on 30th day for those months don't contain the 31th day.
    Thanks,
    John

    The recurrence rule logic is patterned after the recurrence
    logic in iCalendar (http://www.ietf.org/rfc/rfc2445.txt)
    If you have questions, first look there. Then look at the
    schema itself.
    In the schema the definition of DayOfMonth will handle
    negative numbers:
    <xs:simpleType name="DayOfMonth">
    <xs:restriction base="xs:byte">
    <xs:minInclusive value="-31"/>
    <xs:maxInclusive value="31"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="DayOfMonthList">
    <xs:sequence>
    <xs:element name="day" type="tns:DayOfMonth" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    So, the last day of the month would be -1. The second
    to last day would be -2 and so on.
    >>> On Wednesday, May 26, 2010 at 11:56 AM, Johnny
    77<[email protected]> wrote:
    > Hi Preston,
    >
    > I am trying to create a monthly recurring appointment occurs on last
    > day of every month in .Net. E.g. start at May 31, 2010 end at May 31
    > 2011 every month.
    >
    > I specified the frequency as monthly, byMonthDay[0] = (sbyte)31. But
    > this only generates the instances on those months contain the 31th day.
    > My question is how to also create instances on 30th day for those months
    > don't contain the 31th day.
    >
    > Thanks,
    > John

  • How to run procedure/job only on third business day of the month

    Hello All,
    how can i run the procedure/job only third business day of the month? I am using month table in my procedure and it gets updated only once in month and procedure doesn't need to run everyday.

    >
    how can i run the procedure/job only third business day of the month? I am using month table in my procedure and it gets updated only once in month and procedure doesn't need to run everyday.
    >
    For such a sparse schedule the easiest way is to DBMS_SCHEDULER and set the 'repeat_interval' using the BYDATE parameter.
    See Table 14-7 in chapter 114 DBMS_SCHEDULER of the PL/SQL Packages and Types doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sched.htm#BABEJGCH
    >
    Table 114-7 Values for repeat_interval
    BYDATE
    This specifies a list of dates, where each date is of the form [YYYY]MMDD. A list of consecutive dates can be generated by using the SPAN modifier, and a date can be adjusted with the OFFSET modifier. An example of a simple BYDATE clause is the following:
    BYDATE=0115,0315,0615,0915,1215,20060115
    The following SPAN example is equivalent to BYDATE=0110,0111,0112,0113,0114, which is a span of 5 days starting at 1/10:
    BYDATE=0110+SPAN:5D
    The plus sign in front of the SPAN keyword indicates a span starting at the supplied date. The minus sign indicates a span ending at the supplied date, and the "^" sign indicates a span of n days or weeks centered around the supplied date. If n is an even number, it is adjusted up to the next odd number.
    Offsets adjust the supplied date by adding or subtracting n days or weeks. BYDATE=0205-OFFSET:2W is
    >
    The chapter has examples.

  • How to interpret the current day of the month

    I am a rookie in java and am trying to play with the Calendar class.
    The DATE static field of this class says it returns "Field number for get and set indicating the day of the month."
    So, Calendar.DATE has to return the current day of the month.
    Today is 7th of january. So, it should return 7. But, I am getting a value of 5.
    I am very much confused. I fell that my interpretation os wrong.
    Please help.............
    Thanks in advance.

    You must NOT confuse the value of the constant Calendar.DATE (5) and how you can use that constant to retrieve the current day of the month.
            Calendar cal = Calendar.getInstance(); // Gets the current date
            int dayOfMonth = cal.get(Calendar.DATE); // Gets he current day of the month from the current date
                                                     // (Using the Calendar.DATE constant as method parameter).
            System.out.println("Calendar.DATE = " + Calendar.DATE); // Prints the constant
            System.out.println("dayOfMonth = " + dayOfMonth); // Prints the current day of month

Maybe you are looking for

  • How can I convert an InputStream to a FileInputStream ???

    How can I convert an InputStream to a FileInputStream ???

  • New MacBook Final Cut Studio More Detials.

    Hi since my latest posts have not been very informational Than here is a complete new more detailed one. I have purchased a Panasonic HDC-SD9-8GB The SD9 records to a 8GB SDHC card It can record Full HD 1920x1080/24p or 1920x1080/60i It can record at

  • Issue on execute multiple SQL Statement on MySQL

    Hi,I plan to execute dozenes of INSERT SQL statement on MySQL by JDBC:org.gjt.mm.mysql.Driver,But it throws the unkown exeption,pls kindly help The code is like the follwoing sql="insert into TEST values('100','test') "; stmt=cnMySQL.createStatement(

  • Which MacBook for processing Nikon D800 files

    I'm considering a few MacBook options and would appreciate advice on performance: MBA 11" i7 8GB MBA 13" i7 8GB rMBP 13" i5 8GB I'm shooting a Nikon D800 which generates RAW/NEF files around 37-42MB, and when created into a TIF can get up to 200MB. 

  • Error message: "Desktop cannot be modified."

    If I try to create files or an alias on the Desktop I receive an error message "Error... Desktop cannot be modified." As a result I am unable to save anything to the desktop. This problem just surfaced in the past couple of days. Any ideas how to rem