[SQL] how can i get this result....??(accumulation distinct count)

[SQL] how can i get this result....??(accumulation distinct count)
Hi everybody,
pls tell me how can it possible to get result?
### sample data
date visitor
10-01 A
10-01 A
10-01 B
10-01 B
10-01 C
10-01 C
10-02 A
10-02 C
10-02 C
10-02 D
10-02 D
10-03 B
10-03 B
10-03 B
10-03 A
10-03 A
10-03 F
10-04 A
10-04 A
10-04 F
result that i want...like this.
date date_unqiue_visitors acc_date_unique_visitors
10-01 3 3
10-02 3 4
10-03 3 5
10-04 2 5
date distinct visitors : count(distinct visitor)
but how can i get accumulation distinct visitor count???
Thanks to every body..

SQL> select dt,cnt,sum(cnt1) over(order by dt) cnt1
  2  from(
  3  select dt,count(distinct visitor) cnt,sum(flg) cnt1
  4  from
  5   (select dt,visitor,(select decode(count(*),0,1,0)
  6                           from test
  7                           where rowid < t.rowid
  8                           and visitor = t.visitor) flg
  9   from test t)
10  group by dt);
DT                CNT       CNT1
10-01               3          3
10-02               3          4
10-03               3          5
10-04               2          5
Message was edited by:
        jeneesh
Wrong...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • How can i get this result?

    I want to make a menu bar like this:
    http://otn.oracle.com/tech/blaf/specs/tabs_nav/level2_tabs.gif
    Please help me.
    Thanks.

    You want to use a pageLayout with tabs and pageHeader filled with tabBar and globalHeader respectively. You can find information about pageLayout and these other components in the UIX Developer's Guide and the UIX Element Reference, available in JDeveloper's help system or online at: http://otn.oracle.com/jdeveloper/help
    You can also get this by using the wizard to create a UIX page with header, footer and navigation -- it will set this up for you.
    A simple example would be like this:
    <pageLayout>
    <tabs>
    <tabBar>
    <contents>
    <link text="Home" destination="#" />
    <link text="Shop" destination="#" selected="true" />
    <link text="Order History" destination="#" />
    </contents>
    </tabBar>
    </tabs>
    <pageHeader>
    <globalHeader>
    <contents>
    <link text="Catalogs" destination="#" selected="true" />
    <link text="Shopping Lists" destination="#" />
    <link text="Corporate Lists" destination="#" />
    </contents>
    </globalHeader>
    </pageHeader>
    <contents>
    <!-- main body of your page goes here -->
    </contents>
    </pageLayout>

  • Please Give me reply for this problem(How can I get the result)???

    Hello Friends,
    I have one table CXATCMS.Which has 3 columns and has the following data
    start_no end_no activity_date
    05001000001 05001000002 01-OCT-03
    05001000015 05001000016 01-OCT-03
    05001000017 05001000018 12-JUN-05
    05001000019 05001000020 12-JUL-06
    I have to create a report which lists the the specific range.
    If the next record's start_no is the immediate next number for the prevoius record's
    end_no .....then it has to display all those numbers in a range until it finds a number which is not next immediate number for the previous record's end number.
    like for example....if the user wants to see from 1 to 20 range.
    then the result must be like this........
    start_no end_no
    05001000001 05001000002-------there is no 05001000003 number in the
    05001000015 05001000020 start numbers so it has to stop its range by this number).
    How can i get this result........

    Hi,
    Try this. I am sure you know how to write procedure, I have skipped those obligations, anyway u can sense the absic way of working from here I think. Pls do the uppercase / lowercase adjustment as required by your operating system.
    Declare
    mnd CXATCMS.end_no%type;
    numRec CXATCMS.%rowtype;
    Cursor C is select * from CXATCMS where start_no between 1 and 20 order by start_no;
    begin
    select min(end_no)+1 into mnd from CXATCMS where start_no between 1 and 20;
    open C;
    Loop
    fetch C into numRec;
    DBMS_OUTPUT.putline(numRec);
    exit when mnd<>numrec.start_no;
    if mnd=numrec.start_no then
    mnd:=numRec.end_no + 1;
    end if;
    end loop;
    Exception
    when no_data_found raise application_error;
    end;
    gimme feadback pl,
    Pragati.

  • How can I get this thru SQL ?

    Hi,
    I am having following sample data
    NUMRUB FORMAT
    1 X(02)
    2 9(02)
    3 9(08)
    4 X(20)
    5 9(01)
    6 X(03)
    7 9(1)
    8 X(02)
    9 9(02)
    I want output in following way
    NUMRUB FORMAT NewFormat Start Position
    1 X(02) 2 1
    2 9(02) 2 3
    3 9(08) 8 5
    4 X(20) 20 13
    5 9(09) 9 33
    6 X(03) 3 41
    7 9(1) 1 44
    8 X(02) 2 45
    9 9(02) 2 47
    How can I get this thru SQL ?
    Pl guide me.
    thanks & regards
    PJP

    SQL> create table mytable (numrub,format)
      2  as
      3  select 1, 'X(02)' from dual union all
      4  select 2, '9(02)' from dual union all
      5  select 3, '9(08)' from dual union all
      6  select 4, 'X(20)' from dual union all
      7  select 5, '9(09)' from dual union all
      8  select 6, 'X(03)' from dual union all
      9  select 7, '9(1)' from dual union all
    10  select 8, 'X(02)' from dual union all
    11  select 9, '9(02)' from dual
    12  /
    Tabel is aangemaakt.
    SQL> select numrub
      2       , format
      3       , to_number(regexp_replace(format,'(X|9)\((.*)\)','\2')) "NewFormat"
      4       , nvl
      5         ( sum(to_number(regexp_replace(format,'(X|9)\((.*)\)','\2')))
      6           over (order by numrub rows between unbounded preceding and 1 preceding)
      7         , 0
      8         ) + 1 "Start Position"
      9    from mytable
    10   order by numrub
    11  /
        NUMRUB FORMA  NewFormat Start Position
             1 X(02)          2              1
             2 9(02)          2              3
             3 9(08)          8              5
             4 X(20)         20             13
             5 9(09)          9             33
             6 X(03)          3             42
             7 9(1)           1             45
             8 X(02)          2             46
             9 9(02)          2             48
    9 rijen zijn geselecteerd.Regards,
    Rob.

  • My Firefox start page had a check box for searching Canadian pages which was lost when I upgraded to 4.0. How can I get this back?

    My Firefox start page had a check box for searching Canadian pages which was lost when I upgraded to 4.0. How can I get this back?

    The default about:home page in Firefox 4 doesn't give such features. You can set the home page to http://www.google.ca to get that possibility. The results page has a "Pages from Canada" link in the side menu at the left.

  • In version 3.x.x I used to be able to type search terms into the address bar and the page would load, similar to Google's "Feeling Lucky" button. Now it just brings up a Google search for the terms I typed in. How can I get this time saving feature back?

    In version 3.x.x I used to be able to type search terms into the address bar and the page would load, similar to Google's "Feeling Lucky" button. Now it just brings up a Google search for the terms I typed in. How can I get this time saving feature back?

    The change between Firefox 3.6.* and Firefox 4 is how location bar search works. In Firefox 3.6 it uses Google "Browse by name" search. With the browse by name search, it performs a Google search and if there is a clear match it will take you to the site, otherwise it shows the Google search result. With Firefox 4 it just performs a Google search if you type something which is not recognised as a URL.
    To get the Firefox 3.6 behaviour on Firefox 4 you need to change a hidden preference.
    # Type '''about:config''' into the location bar and press enter
    # Accept the warning message that appears, you will be taken to a list of preferences
    # Locate the preference '''keyword.URL''', double-click on it and change its value to the link shown below
    [http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q= http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=]
    If you prefer, you can also do this by installing the Browse by Name extension - https://addons.mozilla.org/firefox/addon/browse-by-name

  • WHAT iS THIS EFFECT CALLED? OR HOW CAN I GET THIS EFFECT?

    WHAT'S THIS EFFECT CALLED? OR HOW CAN I GET THIS EFFECT?
    first of  all i don't know what's this kind of photo effect called, i just describe it as bright, clean and w/o lack of contrasts
    secondly, i wanna learn how to achieve this effect.....really don't know how
    need help here....
    btw i don't know where to post this post....so i just start from here  =)\

    For my part you are welcome, Lisa.
    then what about the color tone here? it's very pure and clean, a touch of blue i think, is it from the nature light or from photoshop effect?
    The colour tone is (hopefully) a result of the nature of the natural light faithfully reproduced by the high quality of the camera (and film if relevant).
    You will get quite different and sometimes rapidly changing tones of colour depending on the natural light; this is different for different times of day, different directions, different weather conditions.
    Just to mention a few comparisons, the warm light from the setting sun is quite different from the cool light from the clear bright sky through a (high) window to the north at noon, and the light of the sun can be changed immensely by the huge white (or grey) filter sometimes applied to (parts of) the sky.
    You may do many things in Photoshop, but photography is still an art form, not just cheating, at least for some.
    I believe one of the real provings of cameras/films is the ability to reproduce the delicate but profoundly different tinges in snow on a clear day.

  • How can I get required result

    How can I get bellow result...
    For row 1 in Table X: There should be one row in result table.
    For row 2 in Table X: These should be 2 rows one for each package code
    For rows 3 and 4: The X table should be joined with Table Y and create the # of rows depending on the # of Section codes that are in the range of B01M-U01M and B04F-U04F. These are just some sample rows, they code be several rows with the above scenarios in those tables.
    Table X
    Grp_#
    Grp_Name
    Package num
    Product #
    111
    aaa
    123
    PPO
    222
    bbb
    002, 007
    EPO
    333
    ccc
    108-B01M-U01M
    CMM
    444
    ddd
    008, 128-B04F-U04F
    PPO
    Table Y
    ID
    Grp_#
    Pkg_cd
    Section_num
    1
    333
    108
    B01M
    2
    333
    108
    E01M
    3
    333
    108
    U01M
    4
    444
    008
    B04F
    5
    444
    008
    D04F
    6
    444
    008
    M04F
    7
    444
    008
    U04F
    8
    444
    128
    B04F
    9
    444
    128
    C04F
    10
    444
    128
    U04F
    11
    111
    123
    B01E
    12
    222
    002
    B01G
    13
    222
    007
    M04G
    Result Table
    Grp_#
    Grp_Name
    Package num
    111
    aaa
    123
    222
    bbb
    002
    222
    bbb
    007
    333
    ccc
    108-B01M
    333
    ccc
    108-E01M
    333
    ccc
    108-U01M
    444
    ddd
    008-B04F
    444
    ddd
    008-D04F
    444
    ddd
    008-M04F
    444
    ddd
    128-B04F
    444
    ddd
    128-C04F
    444
    ddd
    128-C04F
    444
    ddd
    128-U04F
    Thanks in advance.
    Thanks
    Pathan

    I am very sorry, please ignore this mail..... I have pasted more thread. I am unable to paste table format over here.
    Thanks
    Pathan

  • HT3965 my iPhone says Phone is disabled try again in 23,155,698 minutes, how can I get this deleted so I may use this is iPhone again?

    my iPhone says Phone is disabled try again in 23,155,698 minutes, how can I get this deleted so I may use this is iPhone again?

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.

  • TS3198 i just unlocked my i phone 4s. how can i get that result?

    i just unlocked my i phone 4s. how can i get that result?

    1# Make sure you have an internet connection in iTunes.
    2# An AT&T Real MicroSIM(not one that has been cut down) must be in the phone.
    3# Restore in iTunes.
    Hope this helps!!

  • Adobe CR 6.7 does not install into CS5, how can I get this installed to view CR files?

    Just installed CS5 onto new computer. Adobe bridge and CS5 do not recognize CR format. How can I get this installed. I have tried up dating and downloading the CR6.7 update, but can not get it to install. What do I do?

    Product updates

  • Hello, I want to restore a backup on my Iphone 4S, but in i-tunes it's not vissable. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!

    Hello, I want to restore a backup from this afternoobut in i-tunes it is not visseble. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!

    Follow the steps in this article to restore from iTunes back up:
    http://support.apple.com/kb/HT1766
    Since you say you cant see the back up in iTunes you should be able to see it when following the last step where it says for iTunes 10.7 or earlier. Dont worry as this step also works for iTunes 11.

  • TS1702 My cars 2 app mate app is not working after upgrading from ipad to ipad 2...... synced.... uninstalled and re installed several times as well as wiped ne ipad out and re did the whole proccess several times. how can I get this app working?

    I have installed the cars 2 app mate on a ipad 2 from an ipad 1 synced with itunes account.. all is working except this app. After many times of un installing and re installing aswell as talking to apple tech suport this app is still not working.... its there it just has no function...... how can i get this installed and working, my grandson is autistic and uses this app many hours a day........ it is important for me to get this up and running again for him.......

    (1) So, I found a youtube video showing how to open up my iMac and replace a Disk drive. I opened it. I removed the disk drive. I opened the metal cover of the lid of the disk drive. It was clean and immaculate; so, it destroyed and debunked the dirty drive theory. But, just to make sure I sucked around the optical sensor with a vacuum and gently brushed it with a Q-tip.
    (2) I then watched a you tube video showing how the drive operated (it was a drive supplied with power outside an iMac with a transparent cover unlike the opaque metal cover that we have on our drives). My scientific curiosity started to wonder if somehow the mechanical part (of the electro-mechanical assembly) was locked or jammed. So, I started messing with the arms with the utmost care after watching the video to see if i could move them manually. Yes on some. The main arm that is linked with the drive motor was immovable. The rest I played with a little bit, took great notice in the start of the video to see how the arms looked before inserting a disk. I then put it all back together.
    It works now. My guess is that taking it out and then placing it back in along with the resetting options that others have done was the trick. I believe it is a possibility that the hard drive became locked mechanically in some strange manner after ejecting a DVD in conjunction with the uploading of the new OS. I believe the actual removal, reinstallation, and resetting of the drive put everything back into sync. My computer sits in a climate controlled dust free environment. I knew for a fact that this hard drive was OKAY.

  • My iPod Classic is seen by Windows but not by iTunes.  I have reset it, gone to disk mode and it won't show up in iTunes.  There appears to be music on it in a file called MUSICSAVE.  How can I get this to work with iTunes again?

    My iPod Classic is seen by Windows but not by iTunes.  I have reset it, gone to disk mode and it won't show up in iTunes.  There appears to be music on it in a file called MUSICSAVE.  How can I get this to work with iTunes again?

    1. Update iTunes to the latest version. Plug in your iPod. If iTunes still can't recognize it, then in iTunes in the top left corner click help> run diagnostics. On the box that comes up, check the last two things. Click next and it should identify your iPod.
    2. Click on your windows start menu. Type in "services". Click on it and when it pops up, on the bottom of it click on "standard". Now Scroll down to find "Apple Mobile Device" Right click it when you see it and click on "Start". When it has started, close iTunes and replug in your iPod and it should show up.
    3. Check the USB cable
    4 Verify that Apple Mobile Device Support is installed
    5. Restart the Apple Mobile Device Service and verify that the Apple Mobile Device USB Driver is installed.
    6. If you just want to add some photos, songs and movies from computer to your devices, you can use an iTunes alternative to do the job
    7. Check for third-party software conflicts.
    <Link Edited By Host>

  • My "Hanging with Friends" app keeps crashing whenever I try to open it. I have deleted and re-downloaded the app, restarted my iPhone, and even restored my iPhone all together, and nothing is working. How can I get this app to work again?

    My "Hanging with Friends" app keeps crashing whenever I try to open it. I have deleted and re-downloaded the app, restarted my iPhone, and even restored my iPhone all together, and nothing is working. How can I get this app to work again?

    Can you start Firefox in [[Safe mode]] ?
    You can also do a clean reinstall and download a fresh Firefox copy from http://www.mozilla.com/firefox/all.html and save the file to the desktop.
    Uninstall your current Firefox version and remove the Firefox program folder before installing that copy of the Firefox installer.
    It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    You can initially skip the step to create a new profile, that may not necessary for this issue.
    See http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

Maybe you are looking for