Given the table and data below, without joining the table to itself, how do

Hi
could you please help me about following?
create table units
( report_date date
, company_id number
, units number );
insert into units values ('1-jan-2010', 1, 28);
insert into units values ('3-jan-2010', 2, 20);
insert into units values ('7-jan-2010', 2, 10);
insert into units values ('1-jan-2010', 2, 10);
insert into units values ('2-jan-2010', 1, 30);
insert into units values ('3-jan-2010', 1, 49);
insert into units values ('4-jan-2010', 2, 40);
I want the report to look like this:
Company_id | report_date | daily_units | month_to_date_units
1 | 1/1/2010 | 28 | 28
1 | 1/2/2010 | 30 | 58
1 | 1/3/2010 | 49 | 107
2 | 1/1/2010 | 10 | 10
2 | 1/3/2010 | 20 | 30
2 | 1/4/2010 | 40 | 70
2 | 1/7/2010 | 10 | 80
Regards

Hi,
Try this:
SQL> ed
Wrote file afiedt.buf
  1  select report_date,company_id,units ,
  2* SUM(units) OVER ( PARTITION BY company_id,TO_CHAR(report_date,'MON-YY') ORD
ER BY company_id,report_date) FROM units
SQL> /
REPORT_DA COMPANY_ID      UNITS
SUM(UNITS)OVER(PARTITIONBYCOMPANY_ID,TO_CHAR(REPORT_DATE,'MON-YY')ORDERBYCOMPANY
01-JAN-10          1         28
                                                                              28
02-JAN-10          1         30
                                                                              58
03-JAN-10          1         49
                                                                             107
01-JAN-10          2         10
                                                                              10
03-JAN-10          2         20
                                                                              30
04-JAN-10          2         40
                                                                              70
07-JAN-10          2         10
                                                                              80
7 rows selected.

Similar Messages

  • Questions on Xontrol--H​ow to update the state and data

    Hello, everyone. I am new to use the XControl. I don't understand how the program in the facade update the "state" and "Data" after we click the button. I cannot do that, please give me some help on the XControl.
    My vi is in the attachment.
    Message Edited by McArthur on 03-24-2010 02:19 AM
    Working...
    Attachments:
    Button.zip ‏51 KB

    McArthur wrote: Now I understand the reason why the state can not update, because I didn't do as TCPlomp mentioned. It seems working now....
     I mentioned this too, however without a pretty picture.
    quote: 
    When you modify data or state, you need to update the action cluster to indicate that fact.
    McArthur wrote: The example is just a dummy, not really make sense.
    The example is really quite good and shows these things too as well as many other important points. Please try to fully understand it. 
    I would strongly advise you to also look at my other suggestions. You still haven't explained the purpose of the xcontrol. I am still curious.  
    LabVIEW Champion . Do more with less code and in less time .

  • How do I keep the time and date stamp of my photo when exporting from iphoto

    Hi,
    I notice the time and date stamp changed when I exported the photos from iPhoto 11 to a external HDD.
    When I looked at the information about the exported photos on my external HDD the time and date changed to the time and date of when I exported the photos form iPhoto instead of keeping the time and date information of when the photo was taken as it appears in iPhoto.
    I thought the time and date stamp is in the meta data of the photo file and can't be changed, am I correct?
    Thanks,

    Kyzelios,
    How can view the meta data from "finder" or do I need a 3rd party app?
    "Get info" function only gives me the creation date which is the export date and time.

  • TS1702 when i am trying to download new game from app store it showing "to check the time and date settings"?

    when i am trying to download new game from app store it showing "to check the time and date settings"?

    planb77  The OP said he has iOS 3. The Automatic in Settings>General>Time and Date was introduced in iOS 5. The OP just has to see if the time and date, included time zone, are correct.

  • List of Number format and Date format according to the Locales

    Hallo everyone.
    I am searching for a list or document which includes the number and date formats according to the country locales. Where can I find sort of document?
    Another question: Where can I find the all parameters of swing.properties file?

    "Date - allows the user to enter a date as a parameter. Note that the data type must also be "Date" and the format must be Java date format."
    Page 4-9, Adding Parameters and Lists of Values
    Oracle® Business Intelligence Publisher
    Report Designer's Guide
    Release 10.1.3.4
    Part No. E12187-01

  • Ihave over 7gb of saved text messages that i cant delete, ive deleted all my texts and it still says that. ive read that backing up with icloud and turning off documents and data would eliminate this issue... well how...?

    icloud will not allow me to backup my phone because of the 7gb of data its too much for the 5gb free space on icloud and i have the documents and data turned off in the icloud settings so i dont understand whats taking up all the space? the only thing i have on the settings is my photos and thats only 4gb. SOMEONE HELP ME!!!

    I have this identical problem.  For a while my group texts didnt show up on my ipad.  Then one day they did, maybe everyone in the group started using the same os version or something.  Ever since my first reply to the group there have been complaints of multiple threads.  I can not find a pattern for when my group text's decide they want to create a new thread. (it doesnt happen every time)  Everyone in the group has deleted the thread, we've all toggled imessage on/off etc.  There still hasn't been a solution.
    Any help would be appreciated.
    Thanks

  • I performed a time machine backup without plugging my labtop into a power source. My computer died and all the settings were changed, ie the clock and date were changed back to 2001. So I tried to restore my computer using a previous time machine backup.

    I performed a time machine backup without plugging my labtop into a power source. My computer died and all the settings were changed, ie the clock and date were changed back to 2001. So I tried to restore my computer using a previous time machine backup. (which I now know was wrong). However, when time machine tried to restore it said there was not enough room to do a backup. It seems that it did a half backup because some essential  files such as system profiler are now missing. Can I undo this restore...? What can I do to fix this

    You need to do a full system restore, per Time Machine - Frequently Asked Question #14.
    If that sends a message, please note the exact wording.

  • I have allowed my iTunes Match subscription to expire, because of a limited data plan so can't listen to music outside my house. My music files were removed from my computer and are inaccessible without renewing the subscription. How do I get them back?

    I have allowed my iTunes Match subscription to expire, because of a limited data plan so can't listen to music outside my house. My music files were removed from my computer and are inaccessible without renewing the subscription. How do I get them back?

    Hi,
    I presume you deleted the original files as match would not have done so. Do you have a back up. If so, restore your music from that. If not, your will have lost all your music as this needed to be on your hard drive when you unsubscribed.
    Jim

  • How to extract the size and date from a given file

    Hi,
    I want to extract the size and date of a file (it can be either a video, audio or text file) that the user points to the location of. But I am not sure how. Does Java have an api that can do this? If not is there some other way of doing this? Can anyone help? Thanks in advance.

    Have a look at java.io.File, specifically
    public long lastModified()
    This format returned (I find) is nasty, so then use java.util.Date (or java.sql.Date, look the same on the surface to me) to format it.
    Cheers,
    Radish21

  • BUG: Export DDL and Data fails for mixed case table/column names

    Hi there,
    I have found a bug in SQL Developer. See details below.
    Description:
    When "Export DDL and Data) function is used on a table/columns not named in UPPERCASE, sql generated by SQL Developer is invalid.
    Steps to reproduce:
    - open SQL Developer, connect to DB
    - make a table named "lowerCase" (in double quotes, so it won't be automatically changed to capital letters)
    - you may also add some columns, for example "lowerCol1", "UpCol2", ALLUPCOL3
    - add some data rows to the table
    - choose Tools -> Export DDL and Data
    - check exporting of tables and data, on "filter" tabs choose your "lowerCase" table
    - press "Apply"
    Error:
    Generated SQL contains invalid INSERTs: mixed-case table and columns are referenced without obligatory double quotes, which yields an error when generated script is executed (see below, relevant line is underlined)
    -- DDL for Table lowerCase
    CREATE TABLE "DBO_HT"."lowerCase"
    (     "lowerCol1" VARCHAR2(100),
         "UpCol2" VARCHAR2(100),
         "ALLUPCOL3" VARCHAR2(100)
    -- DATA FOR TABLE lowerCase
    -- FILTER = none used
    -- INSERTING into lowerCase
    Insert into lowerCase (lowerCol1,UpCol2,ALLUPCOL3) values ('lc','uc','auc');
    -- END DATA FOR TABLE lowerCase
    Remarks
    SQL Developer: version 1.2.1, build MAIN-32.13
    Oracle DBs: 9.2 & Express
    OS: Windows 2000 Professional
    If you need any more details/testing, let me know. I'd really appreciate a quick patch for this issue...
    Alternatively, do you know of any other simple way of copying a single database (it's called a schema in Oracle, right?) from one computer to another? Possibly something so simple like detaching->copying->reattaching mdf (data) files in SQL Server... I thought that this "Export DDL&Data" function will do, but as you can see I couldn't use it.
    I just need a simple solution that works - one operation on source to stuff, get the resulting files to other computer and one operation to have it running there... I think that such scenario is very basic, yet I just can't achieve it and I am simply not allowed to spend more time on it (read: our test project fails, my company rejects my "lobbying" and stays with MSSQL :/ )
    Thanks a lot & bye

    Thanks for your reply.
    ad. 1)
    You're right. I just wanted to give some very short feedback on my experiences with SQL Developer, so I didn't think starting new threads would be necessary, but as I was writing it became much bigger than I initially planned - sorry about that. I will make proper threads as soon as possible. Having "Edit post" button on this forum would also be useful.
    ad. 2)
    Generally, you're right - in most cases it's true that "switching DBMS is a major commitment" and "you will produce terrible code" if you don't learn the new one.
    However, I think that you miss one part of market here - the market that I think Express is also targeted on. I'd call it a "fire&forget databases" market; MySQL comes to mind as possibly most common solution here. It's the rather small systems, possibly web-accessed, whose data-throughput requirements are rather modest; the point is to store data at all, and not necesarily in fastest way, because given the amount of data that is used, even on low-end hardware it will work well enough. What's important here is its general ease of use - how easy is to set up such system, connect and access data, develop a software using it, how much maintenance is needed, how easy this maintenance is, how easy are the most common development tasks as creating a DB, moving a DB from test to production server etc. There, "how easy" directly translates to "how much time we need to set it up", which translates to "how much will the development will cost".
    Considering the current technology, switching the DBMS in such systems is not necesarily a major commitment and believe me that you will not produce terrible code. In many cases it's as simple as changing a switch in your ORM toolkit: hibernate.dialect = Hibernate.Dialect.OracleDialect vs MySQLDialect vs MsSql2005Dialect
    Therefore, in some part of market it's easy to switch DBMS, even on project-by-project basis. The reason to switch will appear when other DBMS makes life easier => development faster. From that point of view, I can understand my colleagues giving me an embarassing look and saying "come on, I won't read all these docs just to have db copied to test server". And it doesn't mean "they are not willing to learn anything new", it's just that they feel such basic task should have self-explaining solution that doesn't require mastering any special knowledge. And if they get such simple solutions somewhere else, it costs them nothing to change the hibernate dialect.
    I think Oracle did the great job with introducing the Express to this "fire&forget" market. The installation is a snap, it just works out of the box, nothing serious to configure, opposite to what I remember from installing and working on Oracle 9 a few years ago. In some places it's still "you need to start SQL*Plus and enter this script", but it's definitely less than before. I also find the SQL Developer a great tool, it can do most of what we need to do with the DB, it's also much better and pleasant to use over Oracle 9 tools. Still, a few basic things still require too much hassle, and I'd say taking your schema to another machine is one of them. So I think that, if you do it well, the "schema copy wizard" you mentioned might be very helpful. If I was to give any general advice for Express line of DB/tools, I'd say "make things simple" - make it "a DB you can't see".
    That's, IMHO, the way to attract more Express users.

  • HT5624 I have an expired email account linked to icloud and don't know the password and can't reset the password due to not receiving emails anymore with the email account. Any ideas on how to retrieve the songs and data?

    I have an icloud account linked to an email address that is no longer in service.  I do not have the password for the account and am trying to retrieve the songs and data from the cloud to use on new apple device.  Any way to get a new password, able to open the expired account, without having that email account active?

    Hi there clarethasimmons,
    You may find the information in the article below helpful.
    Apple ID: Changing your Apple ID
    http://support.apple.com/kb/ht5621
    -Griff W.

  • MDM - Examples needed with Tables and Data

    Hi,
    I am new to MDM. I just loaded the Console and Data Manager and connected to an MDM server. I am able to create a repository and browse in the Data Manager. However, I want to get some Table examples and data that go along with it. I am looking for a step by step guide to create some good tables and load actual data into it using a flat file or XML.
    Any help is greatly appreciated!

    Hi,
    MDM Repository Structure:-
    Table Types in MDM Repository
    1.Only one main Table.(Default name is Products)
    2.Sub Tables
    Lookup Sub tables are just one of the powerful ways that MDM enforces Data integrity in an MDM repository.
    (Parent - Child Relationships)
    3.Object Tables
    It is special type of Lookup Subtables.It includes the images ,Sounds,Videos,Binary objects,Text Blocks,Copy Blocks,Text HTMLs and PDFs.You cannot store any object dirctly to the Repository.Instead ,each object is defined or imported into the repository once then linked to a main or subtable field as a lookup into the object table of that type.
    [Object Tables eliminate redunt information ,since each object appears only once in the MDM repository even if it is linked in multiple records.]
    4.Special Tables
    Special Tables include Image variants,Masks,Families,Relationships,Work Flows,Named Searchs,Data Groups and Validation Group Tables.
    [Data Groups and Validation Group Tables are does not exist in the MDM Repository.]
    5.System Tables
    System Table appear under the Admin Node in the console Hierarchy include roles,Users,Connections,Change Tracking,Remote Systems,Portas,Links..etc.
    Creating Look up table.
    1.Create Lookup Table(Type as Hierarchy,Taxonomy,Qualifier)
    2.Add a Field in Main table
    3.Set the type(Hierarchy,taxonomy,Qualifier lookup)
    4.You need to enter or map the lookup table name and field.
    5.When ever u add new record in the Lookuptable,You can able to use that lookup data in the Main Table Record creation.
    I donot have software with me ,otherwise i would have given screenshot to u.
    For further info, U can refer Console reference Guide.
    Best Regards
    Devaraj PK

  • Copy all tables and data from remote schema to local schema

    Hi,
    I am using Oracle 10g Enterprise edition as a database and Windows 7 as the operating system.
    My Requirement is to copy all the tables and data from remote machine database to my local machine.
    I created a DB link between my location schema and remote machine schema. Database link created successful. Error what i am getting when i am trying to import all the tables from the remote data is as mentioned below
    I created a directory gave all the privilege to do read and write on the directory.
    Directory name : DUMP
    Local Schema name / PASSWORD : PRODUCTION / PRODUCTION
    Remote Schema name / Password : portal / m3892!2
    When i run this scrip from command prompt
    impdp PRODUCTION/PRODUCTION DIRECTORY=DUMP LOGFILE=LOCALPROD_MERUPROD.log network_link=MERU_DEV_LOCAL_PROD schemas=portal remap_schema=portal:PRODUCTION TABLE_EXISTS_ACTION=REPLACE
    It is giving me following error please suggest me what is the mistake i couldn't trace
    ORA-31631: privileges are required
    ORA-39149: cannot link privileged user to non-privileged user
    Thanks
    Sudhir

    Thanks I gave the grant permission for the "portal" remote user. I didn't not get the error. Issue am facing now is I need to copy the entire schema of production to my local system production.
    I am currently using the below script to copy. it not working. what might be the reason there is no error message coming but still i don't see any tables in my local system after executing this script
    impdp PRODUCTION/PRODUCTION DIRECTORY=DUMP LOGFILE=LOCALPROD_MERUPROD.log network_link=MERU_DEV_LOCAL_PROD schemas=portal remap_schema=portal:PRODUCTION TABLE_EXISTS_ACTION=REPLACE
    Or suggest me some other script to copy all the tables and procedure function from remote database to my local database using impdp script
    Thanks
    Sudhir

  • How to set border lines in table and also in template in the smartforms ?

    How to set border lines in table and also in template in the smartforms ?
    As I have to create table with following detals
    total row = 3
    row1 = 3 column
    row2 = 6 column
    row3 = 9 column
    for 2nd and 3rd row data to be fetched using coding.
    so can anybody explain me what should i use
    Table or Template ?
    and I want the border like excel format.
    Can anybody suggest me ?
    Thanks
    naresh

    if the data is multiple i.e. line items choose table.
    if the data is single i.e. fixed choose template.
    Create table
    >  Draw u r no lines
    > choose option select pattern
    > select display framed patterns
    Choose u r required one.
    out lined, or full lined. u can choose option.
    same procedure to be followed for template also.
    with regards,
    Kiran.G

  • VIew all tables and data in MaxDB

    Is there any software that is able to view all the tables and data in the MaxDB instance?

    Hello
    Assuming, that you are looking for information about the DB's catalog, please consider the catalog functions of JDBC or ODBC.
    Surely there exists a lot of free tools, gathering the catalog via JDBC/ODBC of a database.
    Regards  Thomas

Maybe you are looking for

  • SOAP Receiver adapter with attachments not working

    Hello, I have a simple synchronous scenario like this; ABAP proxy with attachments to SOAP with attachments. The SOAP receiver adapter has been configured with the parameters 'Do not Use SOAP envelope' and 'Keep attachments'. We create our own SOAP e

  • Safari 4.1.3 won't let me type in URL bar

    I'm using Safari 4.1.3 in OSX10.4.11 on a PowerPC G4 12 inch Powerbook. Last night I suddenly became unable to type in the URL bar. If I try to, my cursor changes to the pinwheel and never stops, so I must force quit. I can still highlight and delete

  • Zone Paging

    Hi, Please send document to develop coding for the following Zone Paging in Cisco IP Phone Audio Text Text-to-Speech Analog Overhead Paging System Integration Live Audio Broadcast Pre-recorded-Audio/Text/TTS Pre-scheduled-Audio/Text/TTS Short email f

  • What is grinding sound on my iMAC

    I had my hard drive replaced and upgraded my desktop to snow leopard.  Since then the computer has a grinding sound coming from it.  The spinning ball of death appears frequently dispite taking actions to clear cache, etc.  Am I doomed to need to rep

  • What is a f4v file?

    When I export my footage, Elements creates a f4v file, but when I click on it, Windows tells me that it cannot open it.