With the help of analytical functions above and follow

Hello

Assume, I the date as follows:
customerid    orderid                      orderdate    
-------------    ----------                    --------------
xyz                       1                       01/10/2010
xyz                       2                       02/11/2010
xyz                       3                       03/12/2011
xyz                       4                       03/01/2011
xyz                       5                       03/02/2011
xyz                       6                       03/03/2011
abc                       7                       10/09/2010
abc                       8                       10/10/2010
abc                       9                       10/11/2010
abc                       10                     10/01/2011
abc                       11                     10/02/2011
abc                       12                     10/03/2011
Now I want to gerenate a report based on the above data as below:

CustomerID, number of orders placed in the last 30 days of the new year (01/01/2011), no orders placed with 60 during the last days of the new year, no.. orders placed in the last 90 days of the new year, no orders placed within 30 days of the new year, no.. orders placed within 60 days of the new year, no.. orders placed within 90 days of the new year


I am trying to do this using the following code, but could not succeed:
    select c.customerid,
    count(*) over (partition by c.customerid order by c.orderdate RANGE interval '30' DAY PRECEDING) as "Last 1 month",
    count(*) over (partition by c.customerid order by c.orderdate RANGE interval '60' DAY PRECEDING) as "Last 2 months",
    count(*) over (partition by c.customerid order by c.orderdate RANGE interval '90' DAY PRECEDING) as "Last 3 months",
    count(*) over (partition by c.customerid order by c.orderdate RANGE interval '30' DAY FOLLOWING) as "Following 1 month",
    count(*) over (partition by c.customerid order by c.orderdate RANGE interval '60' DAY FOLLOWING) as "Following 2 months",
    count(*) over (partition by c.customerid order by c.orderdate RANGE interval '90' DAY FOLLOWING) as "Following 3 months"
    from customer_orders c where orderdate < to_date('01/01/2011','dd/mm/yyyy')
Kindly help. Thanks in advance.

Published by: 858747 on May 13, 2011 03:40

Published by: BluShadow on May 13, 2011 11:57
addition of {noformat}
{noformat} tags to retain formatting.  Please read: {message:id=9360002}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

Tags: Database

Similar Questions

  • With the help of analytical functions

    Hi all

    I'm using ODI 11 g (11.1.1.3.0) and I'm doing an interface using analytical functions in the column map, something like below.
    Salary on (partition of...)

    The problem is that when ODI saw the sum he considers this an aggregate function and the group. Is it possible to understand that it is not an aggregate in ODI function?


    I tried to create an option to specify whether it is analytic, then updated IKM with no luck.
    < % if (odiRef.getUserExit("ANALYTIC").equals("1")) {% >}
    < %} else {% >}
    < % = odiRef.getGrpBy (i) % >
    < % = odiRef.getHaving (i) % >
    < %} % >

    Thanks in advance

    Seth,

    Try this thing posted by Uli:
    http://www.business-intelligence-quotient.com/?p=905

  • How to create the ISO image of windows 8 with the help of boot, efi, sources, and support files

    Hello
    I followed folders in my USB key:

    Boot
    EFI
    Sources
    Support,

    and the following files:

    Setup
    Bootmgr.EFI
    Bootmgr

    How can I create an ISO image of windows 8 with the help of these files and folders. I even installed ADK, but I couldn't keep up with it.
    I would be very grateful if someone could help me out here.

    Secondly, I would also like to know how to create a system image of WINDOWS 8, where the hard drive breaks down.

    Concerning
    MAK

    If you have the upgrade key, go here

    http://Windows.Microsoft.com/en-us/Windows-8/create-reset-refresh-media

    You can go for the use of win8 / win7 / vista to match highlights you want - and download the win8 installation and run the installation with your key to download you need to install windows from that.  Will allow you to have an iso bootable.

    Make a picture of the control panel system / Windows 7 file recovery / system Image.  I certainly wouldn't put it on dvd.  It will be too.   Find an old preference portable hard drive and buy a $ 20 usb box, get an external hard drive.

  • Problem with the help of DLL functions

    Hello.

    I'm writing a DLL that calls the functions of a DLL camera and them ends and passes of LabView. I wrote some code of practice and the dll of passage of functions and events with Labview and LabWindows/CVI DLLs, so I like to think I have a reasonable understanding on what I'm trying to do. However I keep getting errors in calling the functions of DLL functions camera I want to use in my DLL.

    I have two functions in the camera DLL, XC_AddImageFilter, and XC_RemImageFilter, I would like to wrap and put at disposal in my DLL. When I compile I get the following errors:

    2 link project errors, Undefined symbol '_XC_AddImageFilter' referenced in "ImageFilter.c". Undefined symbol '_XC_RemImageFilter' referenced in "ImageFilter.c".

    I tried to tweak the prototypes in my header file and the change in functions but nothing I try seems to work. I connected the camera DLL in my project in a way that was previously successful with another practice DLLs and I browsed this forum for similar problems, but I can't seem to find a soloution.

    Thank you for taking the time to read this. I hope that you will be able to help me with my problem.

    PS I had problems to join my code so I put an extension .txt at the end and apparently has worked so please forgive the suspicious file extensions.

    Sorry!

    I do not understand the Labview.lib file which is why Labview functions weren't working! Duh!

    #begginer errors!

  • With the help of PHP when SSI and JS are not allowed

    Hello

    I'm new to DW, but I am going through the lessons of the IPC to get up to the level 'standard user '.

    I want to use the Spry menu and other features defined in the IPC, but the hosting service I have used do not have the Server Side Includes or script.  The only authorized script language is PHP 4/5.

    I understand that there may be a way to put the generated Spry JS in a PHP file as part of the Web site.  For the moment, I'm just the lessons of the IPC so I do not have an obligation to use the features of PHP SQL.  Is there some documents/tutorial that I can use to get around this challenge?

    Thank you

    aim9x

    You do something wrong. Your host has no control over any javascript code on the client that you have on your pages side. If this does not work, it is not because of the accommodation. At this point, it might help to provide us with the url so we can see what is exactly the problem.

    And if they do not support SSI (which is hard to believe), then you can still use php include.

  • With the help of &amp; quot; contains &amp; quot; and it does not work for me.

    Hey everybody, thanks for your help. Here's what I'm trying to do:

    < cfif #address # contains "Washington" > you can not access this site. < other > access granted. < / cfif >

    I want to be able to have my site perform certain actions based on the street, that the person feeds. They enter their address in a form, that information is then verified when they submit. If they enter 1234 Washington Street, I think that the above line would be that Washington contained in this string. I tried several times and have had no luck.

    Any suggestions?

    Thanks for the help. I understood where the problem was. This is the problem by trying to fix the bugs of programmers on drugs... lol

    The problem is in the code it says .

    What was going on in this code was just after the definition of the error, the code then was

    Your suggestions help me to find this because I tried both of your suggestions and none worked so I thought, there is something wrong in this code.

    In any case, thanks for you help.

  • With the help of 11.0 FF and it is not FULL SCREEN

    Until today, using the button on the upper right corner, or F11 full screen would put my browser full-screen. This morning... nada, he just of the pieces to the top of the top tool bar

    My son came up with a solution; He suggested by clicking on an empty part of the screen, then selecting the icon full screen... This worked!

    Don't know why this new 'extra' step is necessary now, but that market.
    Hope this will help others meet this situation.

  • Want to 4502eAiO: print SPOOLER STOPPED message. WITH THE HELP OF HP ENVY 4502 AND ACER ICONIA TABLET?

    Have had problem and cannot print. The print spooler if am stopped message. Whenever I look for support with that it seems as if all suggestjons are on Windows or Mac. How do I even stop and restart the print spooler please?

    Hi there Lesyl,

    I see that you cannot print because of an error regarding the print spooler. Have you tried to remove data from the app to the spooler? For that; Settings > Apps > Plugin printing HP Service > clear data.

    Another thing you can try is to start the table in safe mode and see if the print spooler error is always present. How to start your Android phone or tablet in Safe Mode Let me know if you can print in safe mode.

    Don't forget, the laurels is as the version of the Internet to a High Five!

  • With the help of Vlan for LAN and DMZ

    Hello

    For the moment, I have assigned my LAN and DMZ networks to two separate network card (so therefore no Vlan tagging)

    for example vmnic0 = LAN, vmnic1 = DMZ.

    It works well but I like to make changes in the way I want to use two separate physical network adapter and use on the two s two LAN and DMZ nic but now using the VLAN.

    So think of this configuration:

    For each network, I create a Vswitch, in order to obtain a Vswitch named VsLAN, VsDMZ for the case.

    The Vswitch I attribute a two nic Nic will be the day before. as vmnic0, vmnic2 (at rest)

    This Vswitch I create a port group and assign the correct number of VLan as LAN 10 and 20 to the DMZ.

    Create the another Vswitch will have the same Nic but now vmnic0 will be the stanby one.

    Probalby all great so far I think or not?

    Issues related to the:

    -Well this concept where there is a relationship a Vswitch and port group or a switch with multiple exchanges?

    In case a Vswitch with multiple port groups I will assign to group level reserve and the active NIC Port.

    -If I create a group of ports and assiging several Vlan IP packets received by the virtual machine itself also be labelled or not identified?

    Other words. Do I need to configure the NETWORK adapter to the virtual machine also for the same local network ID virtual or not.

    Thanks for your comments.

    Hello

    Change of vlan is a pretty good idea to get the failover and the performance of the network LAN and DMZ. You have confused somewhat however concepts.

    A can only be used in a vSwitch vmnic. So what you want to do is the following:

    Create a vSwitch

    On the vSwitch create two ports: LAN (vlan10), DMZ (vlan20)

    If vmnic0 and vmnic1 have access to the vlan10 and 20, then simply add the two vmnic virtual switch. By default, they will both be active and that's fine. If you do not want to CHANGE the GRPE ports LAN and goto the "failover" tab and put vmnic0 as active and vmnic1 as before. Then do the reverse on the DMZ port group.

    Best regards

    Frank Brix Pedersen

    blog: http://www.vfrank.org

  • With the help of MERGE for update and insert a table

    -Oracle 11 g
    -Windows 2008

    I'm working on a script which requires update on insertion according to requirement.

    I table_a in the Test database and table_b in a Production environment and want to sync database availability.
    I need help to place the dblink (where to put it etc.).
    Here's what I've got so far:

    / * Update the tables for the production of Test environment
    November 28, 2011
    */

    FUSION
    in prod.tbl_link P
    using (select * from test.tbl_link) T
    On(prod.tbl_link.link_id = test.tbl_link.link_id.ID)
    When matched then
    Update
    Set P.LINK_ID = T.L_LINK_ID,
    P.L_URL = T.L_URL =,
    P.L_TITLE = T.L_TITLE,
    P.L_DESCRIPTION = T.L_DESCRIPTION,
    P.ISSUE_DATE = T.L_ISSUE_DATE,
    P.PUBLICATION_DATE = T.L_PUBLICATION_DATE,
    P.LAST_MODIFIED_DATE = T.L_LAST_MODIFIED_DATE,
    P.L_ICON_NEW = T.L_ICON_NEW,
    P.L_ICON_RECENT = T.L_ICON_RECENT,
    P.L_ICON_NEW_FROM_DATE = T.L_ICON_NEW_FROM_DATE,
    P.L_ICON_NEW_TO_DATE = T.L_ICON_NEW_TO_DATE,
    P.L_ICON_RECENT_FROM_DATE = T.L_ICON_RECENT_FROM_DATE,
    P.L_ICON_RECENT_TO_DATE = T.L_ICON_RECENT_TO_DATE,
    P.ACTIVE_FLAG = T.ACTIVE_FLAG,
    P.MODIFIED_BY = T.MODIFIED_BY,
    P.MODIFIED_DATE = T.MODIFIED_DATE,
    P.CATEGORY_ID = T.CATEGORY_ID,
    P.SUBCATEGORY_ID = T.SUBCATEGORY_ID,
    P.SUBJECT_ID = T.SUBJECT_ID,
    P.STATUS_ID = T.STATUS_ID
    When not matched then
    Insert (P.LINK_ID,
    P.L_URL,
    P.L_TITLE,
    P.L_DESCRIPTION,
    P.L_ISSUE_DATE,
    P.L_PUBLICATION_DATE,
    P.L_LAST_MODIFIED_DATE,
    P.L_ICON_NEW,
    P.L_ICON_RECENT,
    P.L_ICON_NEW_FROM_DATE,
    P.L_ICON_NEW_TO_DATE,
    P.L_ICON_RECENT_FROM_DATE,
    P.L_ICON_RECENT_TO_DATE,
    P.ACTIVE_FLAG,
    P.MODIFIED_BY,
    P.MODIFIED_DATE,
    P.CATEGORY_ID,
    P.SUBCATEGORY_ID,
    P.SUBJECT_ID,
    P.STATUS_ID)
    values (T.LINK_ID,
    T.L_URL,
    T.L_TITLE,
    T.L_DESCRIPTION,
    T.L_ISSUE_DATE,
    T.L_PUBLICATION_DATE,
    T.L_LAST_MODIFIED_DATE,
    T.L_ICON_NEW,
    T.L_ICON_RECENT,
    T.L_ICON_NEW_FROM_DATE,
    T.L_ICON_NEW_TO_DATE,
    T.L_ICON_RECENT_FROM_DATE,
    T.L_ICON_RECENT_TO_DATE,
    T.ACTIVE_FLAG,
    T.MODIFIED_BY,
    T.MODIFIED_DATE,
    T.CATEGORY_ID,
    T.SUBCATEGORY_ID,
    T.SUBJECT_ID,
    T.STATUS_ID)

    You cannot update the same column that is used in the join.

    The error is been derived from here:
    on (t.status_id = s.status_id)
    

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:556373000346392260

  • With the help of ASA 5510 L2L and VPN L2TP

    I would let my remote users access to all resources bhind the ASA and my remote branches.

    Here's my setup.  ASA5510 as a hub to the data center.

    172.21.x.x of internal network directly connected

    DMZ directly connected 172.22.1.x.x

    L2L branch1 VPN 10.47.x.x

    L2L branch2 VPN 10.47.y.x

    172.21.y.x remote users L2TP Windows Client

    I can access my internal resources related to the ASA but not the DMZ or branch offices. I need injection road routing and reverse?

    You also need to configure crossed.  http://goo.GL/vLqAR

  • With the help of size/opacity jitter and pen pressure

    I'm relatively new to photoshop. I am currently following a tutorial. He said: ' Set your tool brush (B) in a hard, both round shape size Jitter and Jitter opacity defined on pen pressure mode. " I'm using a wacom tablet. I tried several things and can't seem to understand this. If someone could explain to me how to use and where to find these parameters; I would be extremely grateful!

    Thank you!

    In the window menu, you'll find the brush of the element. This action opens the brush Panel. Here you will find the options you need to change.

  • With the help of com 1

    I have VMware 7.1.6 build 744570. With the help of 'Virtual Machine Settings' and 'Add', I am able to create a serial port as "serial port 2" and "serial port 3", but I can't create port 1 (a.k.a. com1).

    Someone at - it ideas?

    By default, the tool ThinPrint VMware uses COM1.  He is the host printer can be used without having to install specific printer drivers in the comments.  I normally do not use ThinPrint so I just remove the printer settings of the virtual machine and then when I add a Serial Port, which he defined as COM1.

  • Upgrade to LR5.7 and PS Elements 13.  With the help of an SSD that is more complete! Can I remove older versions of these programs without affecting the functionality of the new programs?

    Upgrade to LR5.7 and PS Elements 13.  With the help of a Solid State Drive, which is more complete! Can I remove older versions of these programs without affecting the functionality of the new programs?

    Yes, there is no need to keep older versions of the software on the SSD (or your computer).

    In addition, you mentioned but if the photos are on the SSD, you must move them off the SSD for a typical hard drive, by following these instructions: Adobe Lightroom - find folders and files moved or missing

  • With the help of windows Explorer XP does use CPU to go to 100% and the blocking of the system forever

    With the help of windows Explorer XP does use CPU to go to 100% and the blocking of the system, forever, until closing by force.  What can I do?

    It is very difficult to manage my files.

    I suggest you download Process Explorer. This freeware utility performs a similar function to the Windows Task Manager, but it goes much further.

    For more information about Process Explorer, see here:

    http://www.Microsoft.com/technet/sysinternals/SystemInformation/ProcessExplorer.mspx

    Explorer.exe is used by a number of applications. The posting process and see which element below uses explorer.exe.

Maybe you are looking for