Report of the Group of dates for end of month

Hi guys

I need to get 6 months of data grouped by months end dates...

I need to automate this query so that it looks always to date for the last 6 months

How do I get there?

The reason for writing the automated query, it's that this sql script is assigned to the business objects reporting.

I use the pl/sql

Here's the DOF

create the table #Something
(
base_date datetime, int connections
)

Insert #Something
Select ' 01 jul 2013', 21 Union all the
Select ' 02 jul 2013', all 22 union
Select ' 03 jul 2013', 210 Union all the

....

...

Select July 31, 2013,"Union 498
' Select ' 01 August 2013 ', 44 Union all the
' Select ' 05 August 2013 ', 66 Union all the
...

....

Select ' 03 dec 2013", 456 union all
.

.

'Select December 31, 2013,"788

..............................................................................

Desired output

Connection of base Date

31 jul 500 (not exact, just randomly)

August 31 600

30 sep 356

31 Oct 676

30 Nov 544

31 Dec 456

..............................................................................

Hope this helps

Hello

In Oracle, you can do this:

SELECT LAST_DAY (TRUNC (base_date)) AS last_day_of_month

SUM (connections) AS total_connections

OF something

WHERE base_date > = TRUNC (ADD_MONTHS (SYSDATE,-6), 'MONTH')

AND base_date<  trunc="" (           ="" sysdate,     ="">

GROUP OF LAST_DAY (TRUNC (base_date))

ORDER BY last_day_of_month

;

If you would care to post some CREATE TABLE and INSERT statements so you want the results of work from these data of the sample, then I could test this.

Using Oracle?  #Something (with a sign # at the beginning) is not valid a table name, and datetime is not a valid data type in Oracle.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: https://forums.oracle.com/message/9362002

The query above works if base_date is a DATE or TIMESTAMP.

Since it is now January 2014, what are "the last 6 months?  The above query assumes that they are the last 6 months, that is, July to December 2013.

If you mean the current (incomplete) and 5 months before it (i.e. August 2013 to January 2014), then add 1 month to the two deadlines in the WHERE clause:

WHERE base_date > = TRUNC (ADD_MONTHS (SYSDATE,-5), 'MONTH')

AND base_date<  trunc="" (add_months="" (sysdate, ="" 1) ="">

Tags: Database

Similar Questions

  • Above-report of the Group-new page for every group value.

    Hello

    In schema Scott, I created a simple report with group above.  The taskforce is Deptno.

    Query is - Select * from emp.

    More-> Deptno field group.

    Created deposit of the total salary for deptno.

    report is running. Now, my need is.  for each new deptno - need to create the new page. A Department can have a page or several pages as well.

    If empno repeating frame, "Page break Apres-oui...--> the employees of the Department list is ok, but the total field is printing on the next page.

    But I want to employees of the Department and total salary should appear on the same page.

    How to do this, please

    No it's not true.

    Framework repeting DEPTNO value (for example. R_G_DEPTNO) property of the print Direction through'.

    I hope this works...

    Hamid

  • Include the expected start Date and end Date for the management of SSHRC-Absence

    Is it possible to include the scheduled Start Date and end Date of project to SSHRC, management of absences with the type of leave is confirmed?

    Thanks in advance

    Hello

    In this case, you should disable the option the absence request, so that by default all sheets are confirmed and the user do not have to apply once leave as planned and then comply.

    You can see the id metalink - "How do I disable the State of Absence of R12 Absence Management Page [ID 786691.1]" to understand how to disable "Planned" option to request authorization for simple customization.

    It will be useful.

    Thank you
    Sanjay

  • get all the date of end of months between two dates

    Hi all, I'll try to find together the date of end of months between two dates.
    I have the following data in a table

    WITH AS's Data1
    (
    SELECT To_Date('4/30/2009','mm/dd/yyyy') dt, 'TEST' lname FROM dual UNION ALL
    SELECT To_Date('5/01/2009','mm/dd/yyyy') dt, "TEST2" lname FROM dual UNION all
    SELECT To_Date('5/02/2009','mm/dd/yyyy') dt, "TEST3" lname FROM dual UNION all
    SELECT To_Date('5/03/2009','mm/dd/yyyy') dt, "TEST4" lname FROM dual UNION all
    SELECT To_Date('5/04/2009','mm/dd/yyyy') dt, "TEST5" lname FROM dual UNION all
    SELECT To_Date('5/05/2009','mm/dd/yyyy') dt, "TEST6" lname FROM dual UNION ALL
    SELECT To_Date('5/31/2009','mm/dd/yyyy') dt, 'TEST7' lname FROM dual UNION all
    SELECT To_Date('6/01/2009','mm/dd/yyyy') dt, 'TEST' lname FROM dual

    )

    I would like to write an application that gives you all the end date for months between two dates
    for example, if you give the date 9/1/4 and 5/6/9, the output should be
    DT          LNAME
    -------------------
    4/30/2009   TEST
    IF I give you the dates 01/04/09 AND 01/06/09, THEN output should be
    DT          LNAME
    -------------------
    4/30/2009   TEST
    5/31/2009   TEST7
    as you can see, I want all the end dates of months between two dates by giving the output.

    If I give you 06/05/09 and 05/06/09, and then does so no output because there is no end of month between these two dates.
    Similarly, if I give you 30/04/09 and 30/04/09 then output should be 30/04/09 because it is an end of month date

    anyone can help to write a query. Thank you very much

    Jin
    Not sure if you need subquery, analytical functions for this.
    According to me, which should solve your purpose.

    WITH data1 AS
    (
    SELECT To_Date('4/30/2009','mm/dd/yyyy') dt, 'TEST' lname FROM dual UNION ALL
    SELECT To_Date('5/01/2009','mm/dd/yyyy') dt, 'TEST2' lname FROM dual UNION all
    SELECT To_Date('5/02/2009','mm/dd/yyyy') dt, 'TEST3' lname FROM dual UNION all
    SELECT To_Date('5/03/2009','mm/dd/yyyy') dt, 'TEST4' lname FROM dual UNION all
    SELECT To_Date('5/04/2009','mm/dd/yyyy') dt, 'TEST5' lname FROM dual UNION all
    SELECT To_Date('5/05/2009','mm/dd/yyyy') dt, 'TEST6' lname FROM dual UNION ALL
    SELECT To_Date('5/31/2009','mm/dd/yyyy') dt, 'TEST7' lname FROM dual UNION all
    SELECT To_Date('6/01/2009','mm/dd/yyyy') dt, 'TEST' lname FROM dual 
    
    )
    select distinct last_day(dt) dt,lname
      from data1
     where dt between &start_date and &end_date
       and last_day(dt) <= &end_date
    
    also, i have another request. how would i do this without using the data i provided. lets say,
     i tell you, give me alll the months end between two dates using dual in the from clause of a query.
    how would you do this in a query or pl/sql? thanks again
    

    Can be like that

    with data1 as(
    select &start_date+level-1 dt from dual
    connect by level <= &end_date-&start_date+1)
    select distinct last_day(dt)
      from data1
     where dt between &start_date and &end_date
       and last_day(dt) <= &end_date
     order by last_day(dt)
    

    See you soon!
    Bobin

    Published by: Buga added query for updated the need

  • Best practices for the handling of data for a large number of indicators

    I'm looking for suggestions or recommendations for how to better manage a user interface with a 'large' number of indicators. By big I mean enough to make schema-block big enough and ugly after that the processing of data for each indicator is added. Data must be 'unpacked' and then decoded, for example, Boolean, binary bit shifting fields, etc. The indicators are updated once / sec. I'm leanding towards a method that worked well for me before, that is, binding network shared variable for each indicator, then using several sub-vis to treat the particular piece of data, and write in the appropriate variables.

    I was curious what others have done in similar circumstances.

    Bill

    I highly recommend that you avoid references.  They are useful if you need to update the properties of an indicator (color, police visibility, etc.) or when you need to decide which indicator update when running, but are not a good general solution to write values of indicators.  Do the processing in a Subvi, but aggregate data in an output of cluster and then ungroup for display.  It is more efficient (writing references is slow) - and while that won't matter for a 1 Hz refresh rate, it is not always a good practice.  It takes about the same amount of space of block diagram to build an array of references as it does to ungroup data, so you're not saving space.  I know that I have the very categorical air about it; earlier in my career, I took over the maintenance of an application that makes excessive use of references, and it makes it very difficult to follow came data and how it got there.  (By the way, this application also maintained both a pile of references and a cluster of data, the idea being that you would update the front panel indicator through reference any time you changed the associated value in the data set, unfortunately often someone complete either one or another, leading to unexpected behavior.)

  • 30 to 99 daily Photoshop requires an internet connection. What is the amount of data for this connection?

    Photoshop needs an internet connection after 30 or 99 days. What is the transfer of data for this connection? I ask, because I'm going to work on a ship for a long time and ROAMING costs are very expensive. Maybe it's possible via a mobile phone connection?

    [Left non-technical Forum Lounge for cloud... forum] MOD]

    This is an open forum, not Adobe support... Click below to contact Adobe staff for help

    While the forums are open 24/7 you can't contact Adobe support at any time

    Chat support: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • PowerCLI - there cmdlets to browse the store of data for files/directories and their creation?

    Hello

    PowerCLI - there cmdlets to browse the store of data for files/directories and their creation?

    If Yes, can you please let me know.

    I took a glance at the reference of the cmdlet, but can not find...


    Kind regards

    Dreamer

    You can use the data store provider.

    It is documented in the vSphere PowerCLI Administration Guide that was installed with PowerCLI.

  • Adobe Standard 9.5.2 after update I get the error "insufficient data for an image.

    After the update to Acrobat Standard and devoid 9.5.2, some (but not all) of my pdf files are now open with the error "Insufficient data for a picture." Open files, but they are blurred, pixelated and are missing from the character Ben I applied earlier (by using a utility of LexisNexis Casemap). Fine, I can open the files on another computer with Acrobat Standard 9.5.1.

    How can I uninstall the 9.5.2, or make it work again?

    Acrobat engineering wishes to inform users facing this problem that the latest version of the player (available for download on http://get.adobe.com/reader) XI solves this problem. Users are advised to download the latest version as soon as possible to avoid encountering this error in the future. As mentioned, the team is working hard to solve the problem in earlier versions (10.x and 9.x) as well and plans to deliver a solution by Q1 2013.

    For more information, please see our KB document for this issue:http://helpx.adobe.com/acrobat/kb/insufficient-data-image.html

    Post edited by: David Kastendick

  • Select the most recent DATE for identification.

    Hi all

    I need to SELECT records with the most recent DATE for each code. A DATE range is part of the selection criteria.

    My data.
    MY_ID MY_DATE
    1684662 26 JANUARY 09
    1424097 27 JANUARY 09
    1684663 27 JANUARY 09
    1684664 27 JANUARY 09
    1684672 28 JANUARY 09
    0689073 28 JANUARY 09
    1052476 21 JANUARY 09
    1052476 21 JANUARY 09
    1360828 23 JANUARY 09
    1684661 23 JANUARY 09
    1052476 30 JANUARY 09
    1052476 30 JANUARY 09
    1052476 30 JANUARY 09
    1052476 30 JANUARY 09

    The code below works fine when you select 1 ID in the subselect, but with several ID he always selects rownum = 1 (of course). As far my mind takes me.
    SELECT my_id,
    my_date
    Of
    (SELECT my_id,
    my_date
    FROM my_table
    ORDER BY DESC my_date
    )
    WHERE rownum = 1
    AND * {color: #ff0000} my_id = 1052476 {color} *.
    AND TO_CHAR(my_date,'YYYY/MM/DD') BETWEEN ' 01 / 01/2009 ' AND '' 2009/01/31;

    If I could somehow pass the ID SELECT in the subselect WHERE clause I should have done this.

    Any suggestions?

    Thanks in advance for your help,

    Lou

    One of the many soultions possible.

    ME_XE?with data as
      2  (
      3     select 1684662 as id, to_date('26-JAN-09','dd-mon-yyyy') as the_date from dual union all
      4     select 1424097 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      5     select 1684663 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      6     select 1684664 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      7     select 1684672 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
      8     select 0689073 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
      9     select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
     10     select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
     11     select 1360828 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
     12     select 1684661 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
     13     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
     14     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
     15     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
     16     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual
     17  )
     18  select id, the_date
     19  from
     20  (
     21     select id, the_date, max(the_date) over (partition by id) as max_the_date
     22     from data
     23  )
     24  where the_date = max_the_date;
    
                    ID THE_DATE
    ------------------ --------------------------
                689073 28-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1360828 23-JAN-0009 12 00:00
               1424097 27-JAN-0009 12 00:00
               1684661 23-JAN-0009 12 00:00
               1684662 26-JAN-0009 12 00:00
               1684663 27-JAN-0009 12 00:00
               1684664 27-JAN-0009 12 00:00
    
                    ID THE_DATE
    ------------------ --------------------------
               1684672 28-JAN-0009 12 00:00
    
    12 rows selected.
    
    Elapsed: 00:00:00.03
    
  • date of end of month in SPR

    We must show the date of end of month for a given date in a table.
    The date is March 25, 2008 ", then output should give me 31 March 2008".
    I want to create a new column derived like this in the RPD.
    I think that variables can not help me out here, because we need to have the date of end of month for each value that the date column will hold.
    Please let me know how can achieve us.

    I haven't played a lot with the expression of OBIEE constructor functions but the technique below should work, you can use standard date functions:

    (1) take the month and year of your date column (for example for today, it will be 10/2008) convert it to a string.
    (2) date data type concatenate 01 to the string of the previous step and convert the entire expression. Now you have the first date of the month of your column in a date format.
    ((3) on the date to 2) add 1 month and 1 day to remove and you get the last day of the month for your selected date.

    Should work in OBIEE too.

  • For a designer of shoes, I need more than photoshop and illustrator? is it better to get the full creative cloud for £58 per month? or would I not need all of them? should I get adobe stock as well?

    For a designer of shoes, I need more than photoshop and illustrator? is it better to get the full creative cloud for £58 per month? or would I not need all of them? should I get adobe stock as well?

    @

    Hi Alice,.

    It's totally up to you who request CC will you use and therefore, you can customize your plans.

    Pricing plans and creative Cloud membership | Adobe Creative Cloud

    You can also join Adobe sales for assistance.

    Kind regards

    Sheena

  • Display of the header in the Group Section data

    I'm trying to reformat our 1099 forms and manage obtaining the address appears w / in the table that contains the information of every employee of our company. I can't download the data, because it contains sensitive information, but basically I have a group for info each employee:

    < LIST_G_MAIN_SELECT >
    < G_EMP >
    Rob < NAME > < / NAME >
    < SSN > 11-111-1111 < / SSN >
    < EMP_ADDRESS > 500 any street < / EMP_ADDRESS >
    < / G_EMP >
    < G_EMP >
    < NAME > Steve < / NAME >
    < SSN > 22-111-1111 < / SSN >
    < EMP_ADDRESS > 450 Street < / EMP_ADDRESS >
    < / G_EMP >
    < / LIST_G_MAIN_SELECT >
    < C_COMPANY_ADDRESS > 1000 N 1st STREET < / C_COMPANY_ADDRESS >


    In my model that I use a <? for each: G_EMP? > and then have the info of the employee in the table but I also need to put the C_COMPANY_ADDRESS in each table as well. When I point to this area it is not. I guess it's b/c that is outside the Group?

    Thanks in advance!
    Rob

    Hi Rob,

    Put them in the variable outside the place where it is accessible and access inside the loop
    put this before the loop.

    and inside the loop to access as

    or

    make the loop of the root IE. absolute path not relative path
    something like

    inside the loop, you access the address as

    or

    Would be happy to help you, if I have xml and model, delete sensitive information and send my id :).

  • HOW TO SET THE TIME AND DATE FOR MALAGA SPAIN 29130

    TIME AND DATE FOR MALAGA SPAIN

    Hi Colin,

    Thanks for posting your query in Microsoft Community.

    • Are you referring to a zip code when you say 29130?

    I would refer to the procedure described in the article below to set the date and time in Windows 7.

    Change the display of dates, times, currencies, and measures

    You can also view: set the clock

    Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.

  • How to get the status of data for each virtual [identify overprovisioning] computer store?

    Hi people,

    Could help me is it you please in the generation of report of VM and its data store location (data stocker store free space, size set up and operation). ?

    Ideally, it should be like this:

    The virtual computer name. Name of the data store. Size of the data store. Total configured data store size

    Thank you

    The following script adds the ProvisionedSpaceGB property to the output of the script of Luke:

    Get-VM | ForEach-Object {
      if ($_)
      {
        $vm = $_
        $vm | Get-Datastore | ForEach-Object {
          if ($_)
          {
            $Datastore = $_
            "" | Select-Object -Property @{N="VM name";E={$vm.Name}},
            @{N="ProvisionedSpaceGB";E={$vm.ProvisionedSpaceGB}},
            @{N="Datastore Name";E={$Datastore.Name}},
            @{N="Datastore Size (GB)";E={[Math]::Round($Datastore.CapacityMB/1KB,0)}},
            @{N="Datastore Total Provisioned size (GB)";E={[Math]::Round(($Datastore.CapacityMB-$Datastore.FreeSpaceMB)/1KB+$Datastore.ExtensionData.Summary.Uncommitted/1GB,0)}},
            @{N="Datastore Used Space (GB)";E={[Math]::Round(($Datastore.CapacityMB-$Datastore.FreeSpaceMB)/1KB,0)}}
          }
        }
      }
    }
    
  • Date of end of month

    Hi all
    I have a table "xyz" that captures start_date and end_date in one line.
    i.e. start_date = * 15 October 2007 *, end_date = * 25 - dec - 2008 *.

    I want to write a query that diplay end of month of each month between start_date and end_date as dates me. .

    October 31, 2007
    November 30, 2007
    31-dec-2007
    January 31, 2008
    February 29, 2008
    31-mar-2008
    ..
    ..
    ..
    ..
    ..
    ..
    ..
    ..
    31-dec-2008

    Thanks in advance

    Try this

    select
         last_day(add_months(to_date('15-oct-2007','dd-mon-yyyy'),level-1))
    from
         dual
    connect by level <= ((to_date('01-dec-2008','dd-mon-yyyy') - to_date('01-oct-2007','dd-mon-yyyy'))/30) +1
    /
     
    

Maybe you are looking for