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.

Similar Messages

  • [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...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • HT203167 I have purchased Forbes magazine thru zinio app. My money was deducted but I am not getting the magazine for download inside zinio app. How can I get this fixed?

    I have purchased Forbes magazine annual subscription
    thru zinio app. My money was deducted but I am not getting the magazine for download inside zinio app. How can I get this fixed?

    This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes forums.
    Regards.

  • TS5366 My grandson made a purcase on my account without my permission, my paypal acct had an expired debit card on file and the charge went thru anyway, making my checking acct go negative. How can I get this charge reversed?

    My grandson made a purchase without my permission using my paypal account that has an expired debit card info. and the charge went thru anyway making my checking account go negatve. How can I get this charge reversed?

    Purchases are considered final but you can try the 'report a problem' link to contact iTunes Support and see if they will refund or credit you : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
    If the purchase was made on an iOS device then to try and stop it happening again you can use Settings > General > Restrictions to turn off in-app purchases, and you can require your password to be entered for every download.

  • 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

  • HT4798 i created my apple id account, verified but know i m unable to log on, it says incorrect password, i tried to reset via forgot password option but it does not send reset password page to my e- mail address, how can i get this sorted or delete my pr

    User created apple id account, verified but know she is unable to log on, it says incorrect password, she tried to reset via forgot password option but it does not send reset password page to here e- mail address, how can i get this sorted? or how can i get her whole apple account deleted and created new one using same e - mail address?

    The idea to jumpstart by change was not the smartest one, but gives you an opportunity to use that "temporary" account as permanent. You do not have a choice cause obviously despite you thinking that old account is no more -it does exist on Apple servers. And if you are unwilling to share your [email protected] with friend, just create one extra [email protected] for your friend. One suggestion - do not use gmail.

  • When I am home, calls to my iPhone 5 also go to my other family members' iPhones.  How can I get this to stop happening?

    When I am home, calls to my iPhone 5 also go to my other family members' iPhones.  How  can I get this to stop happening?

    Or better yet, create and use new Apple IDs for others in your household. You could always use different Apple IDs for iCloud services (like iMessage and FaceTime) and iTunes and App Store., but it's even easier to share purchased content now with Family Sharing.

  • I bought 3 iPhone 4s and each should have 5gb of cloud. I want to only use my one iTunes ID. How can I get this storage space increased to the 15 GB?

    I bought 3 iPhone 4s and each should have 5gb of cloud. I want to only use my one iTunes ID. How can I get this storage space increased to the 15 GB?

    iCloud storage is not allocated by device. iCloud storage is allocated to your iCloud AppleID. You get 5GB of iCloud storage.

  • Somehow my iTunes app has been put into the trash.  How can I get this and all of the stuff that was in it back to my Application folder?  I try to drag it out of trash, but it won't work.

    Somehow my iTunes app has been put into the trash.  How can I get this and all of the stuff that was in it back to my Application folder?  I try to drag it out of trash, but it won't work.

    Also, when I do try to drag it out of the Trash to put it back into Applications (on the Finder sidebar), it asks me to authenticate with the administration password.  I enter it, and then a window appears saying that I can't do that because I do not have permission to modify iTunes.  Please help.

  • My ipod nano was synced by itunes and removed all of my music and game files. I am in the process of adding my music back one cd at a time, but there is no history of tetris that I paid for from the itunes store. How can I get this game back for my ipod?

    My ipod nano was synced by itunes and removed all of my music and game files, and replaced my music with my kids music that they have put into the current itunes library. My music is nowhere to be found on my computer, so now  I am in the long, forever process of adding my music back one cd at a time, but there is no history of tetris that I paid for from the itunes store. How can I get this game back for my ipod?

    Contact iTunes support and explain your situation to them.  They may let you redownload it at no cost.
    http://www.apple.com/support/itunes/contact.html
    If they don't, I'm afraid you'll have to purchase it again.  Sorry.
    B-rock

  • In disk utility, it shows that my external hard drive is somehow unmounted and I can't access it in finder or repair it in Disk Utility. How can I get this working without losing my important data?

    In disk utility, it shows that my external hard drive is somehow unmounted and I can't access it in finder or repair it in Disk Utility. How can I get this working without losing my important data?
    Thank you!

    When you erased the disk did you select Mac OS Extended Journaled as the format option?

Maybe you are looking for

  • Possible?Multi-Entity View Object with one Entity Object that is Read-only.

    I know this sounds crazy, but I would like to create a multi-entity view object, where one entity object is based on a table in my application (we'll call it "Users", which basically stores the primary key for the person from the institutional people

  • Mail not showing new messages

    As of about 4 days ago my Mail app is not displaying new e-mails.  It says '19 incoming messages' but they never appear.  I have tried: - Replacing mail.plist with older version from time machine - Rebuilding mailboxes - Asking my web hosts if there

  • Blank photo on CD-R and lost edit mode - thumbnails only

    I tried to save photos on a CD-R and got blank picture frames on the CD in the correct amount and landscape/portrait format along with correct data in the description. The photos transferred remain in the library as thumbnails only and cannot go to e

  • Change pages

    Hi to all, I'm developing a project which is made of many different pages (now there are 30 pages, but I'm planning to add some other); I created a different VI for every page, and a Main VI to launch the correct page (see attached). When I reload a

  • In a label to display a field and searchelp on it...

    hi,      I want a label  "color" in selection screen logic and wle running program once i get the input parameter color label and pressing f4 i need to get the values like red, blue,green etc....