How to get rank within the row in SQL

I have an a key orderid and 4 other columns with orderdate&time in (16/12/2011 16:15:24 format) within a table.
the orderid has an average of 1million rows every week hence could not do this in excel for a 15 day period .
ORderid.........: mail........................................ : telephone ............................:online ........................................ store.......................... Agency
A3456...........15/12/2011 16:15:24 ............... 16/12/2011 14:12:01.............16/12/2011 16:14:00..........17/12/2011 11:22:55 ............12/12/2011 22:20:30
B678
C555
i want to create a new table which ranks each row according to the max orderdate and time say in another table
i want to capture the rank
KEY.......Mail............Tel............online.........store..........Agency
A3456.....4 ...............3...............2...............1............... 5
Is there any way either within the same table or in other table i wiould be able to get the rank based on the rows in SQL.
thnks
Edited by: UOOLK on 29-Dec-2011 06:46

Something like this I think:
create new_order_table as
  select order_id
        ,rank() over (order by mail desc) mail
        ,rank() over (order by telephone desc) telephone
        ,rank() over (order by online desc) online
        ,rank() over (order by store desc) store
        ,rank() over (order by agency desc) agency
    from old_order_table;Assuming you want the most recent date to be ranked number 1. If you want number 1 to be the oldest then remove all the 'desc's from the order by clauses.

Similar Messages

  • How to get AEGP_EffectRefH within the custom effect?

    Hi,
        I want to get the AEGP_EffectRefH of the custom effect applied. This is what I'm trying to do:
    In global setup of custom effect:
    AEGP_GlobalRefcon globalRef    =    NULL;
    const A_char*        pluginName    =    "ADBE Custom Effect";
    AEGP_SuiteHandler    suites(in_data->pica_basicP);
    suites.UtilitySuite5()->AEGP_RegisterWithAEGP(globalRef, pluginName, &S_Plugin_ID );
    After getting the plugin ID, I do this in a function to get the AEGP_EffectRefH:
    I call this function when the custom effect is added:
    void function()
         AEGP_EffectRefH        effect_refH        =    NULL;
         AEGP_SuiteHandler    suites(in_data->pica_basicP);           
         ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(S_Plugin_ID, in_data->effect_ref, &effect_refH));
    But the effect_refH returned is NULL. AE pops up a dialog saying
    After Effects error: internal verification failure, sorry! {child not found in parent}
    (29 :: 0)
    What am I doing wrong?
    Thanks,
    Dheeraj

    about the reliability of effectRefs:
    they are reliable for the duration of one call.
    i.e. for the beginning to the end of the render call or updtate_params_ui call.
    after that cal has ended, the effectRef is likely to become invalidated.
    do an experiment:
    get an effect's effectRef, and check it's address in ram.
    releast the effetcRef and get another effectRef for a DIFFERENT effect.
    check it's adress and you'll be amazed that it has the same address as the first.
    why is that?
    because it doesn't point to the address of that effect in ram.
    it's an internal id that allows AE to operate on the effect for you.
    so that same effectRef you have, might point to a different effect or to nothing at all, once AE decides that the effectRef you acquired is no longer in use.
    AE will decide that after you release the effetcRef, or that you effect returns from it's call.
    so what does all that mean?
    it means you should treat effectRefs and a temporary key for accessing an effect, and NOT as a long term means of identifying and effect.
    there is no perfect solution for tracking an effect for long spans.
    if you want to keep track of an effect outside the scope of one call you have to:
    1. get the itemID for the comp it's in
    2. get the layerID for the layer it's on
    3. get the effect's index on the layer (this is the tricky bit)
    the comp's itemID and layerID both last for the lifetime of the project.
    they will keep across sessions, even if the project is loaded on a different machine and a different platform.
    these only get invalidated if the project is imported into another project.
    the index of the effect is the problem bit.
    there is no API call for getting an effects index.
    you can only tell the index by counting all effects on the layer, until you hit the desired effect.
    even then it's hard to tell because you tell what effect you hit by reading it's matchName.
    what if you have to copies of the same effect on one layer?
    how do you tell them apart?
    it's up to you to create a unique identifier.
    either a hidden slider holding a random value that's unique to each instance, or change the effect name to something unique (the user might change that without you knowing)
    the last problem with the index is that the user might change effects order on that layer, and your effect get no notification of that having happened.
    so even if you stored the itemID, layerID and effect index, you still have to make sure it's the correct effect before you do something hasty like access it.
    as i said,
    there is no perfect long term solution for tracking effects.

  • In Table Control How to get only a single row .

    Hi
    In Table Control How to get only a single row .I am able to decrease it its height to 4 but then 2 rows is getting dsplayed .I want only one row to be display and 2nd row should be deactivated or not visible.
    regards
    Avik
    Edited by: Julius Bussche on Jan 30, 2009 1:10 PM
    Removed friendly greeting from the subject title

    Hi Avik
    use this code it will help you.
    MODULE passdata OUTPUT.
      READ TABLE it_revision INTO wa_rev INDEX tab_clc-current_line.
      IF sy-subrc = 0.
        LOOP AT SCREEN.
          IF screen-group1 = '111'.      " 111 IS THE GROUP NAME
            screen-input = 1.          " input mode
            screen-active = 1.         " input mode.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-group1 = '111'.       "GROUP NAME
            screen-input = 0.           " display mode
            screen-active = 1.          " DISPLAY MODE.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDMODULE.                 " PASSDATA  OUTPUT
    Make sure in group tou are passing the field name that you want in input mode on the base of other field
    Hope it will help you.
    Thanks
    Arun Kayal.

  • How to get control on each row in advance table

    hi, i have a advanced table with some data, in each row i have two radio buttons which i need to set depending on some column value in the row, i tried by following code
    for(SoftCompVORowImpl row2 = (SoftCompVORowImpl)svo.first();row2!=null;row2=(SoftCompVORowImpl)svo.next())
    if(row2.getAttribute("CommitEndDate")==null || row2.getAttribute("CommitEndDate").equals(""))
    onetime.setSelected(true);
    recurring.setSelected(false);
    else
    onetime.setSelected(false);
    recurring.setSelected(true);
    but this code is making set only one radio button (onetime), which ever i am making first true its getting selected, i need to know how to get control of each row....

    Babu,
    Basically you should use the decode function in your sql query itself and attach it with BC4J properties of radio buttons.In that case you don't have to worry about setting them declaratively !
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to get REQNR in the UR (Startroutine)

    How to get REQNR in the UR (Startroutine) ?
    There is no g_s_minfo passed to this form (not like in TR). FM GET_JOB_RUNTIME_INFO does not work.
    Any ideas how to get request number in the start routine of update rule ?
    BR
    Wojciech

    Sorry,
    The field in question is i_requnr.
    You get at it, and other interesting fields like g_s_minfo like this:
    FIELD-SYMBOLS: <l_requnr>.DATA: l_requnr_fieldnm TYPE string VALUE 'I_REQUNR'.ASSIGN (l_requnr_fieldnm) TO <l_requnr>.
    Now you can use <l_requnr> anywhere within the start routine.
    Regards

  • I had to manually download the new version of itunes.. via tools, it gave me 4 items to download and i did not download all 4 compenants.  Does anyone know how to get back to the pop up that contains tools so i can redownlaod all of them.

    I lost my old iphone and have a new 5s.. i need to sync to itunes.  i had to donwload manually via tools but i didnt download all four files.  now when i plug my phone into itunes it says there is an error bc i didnt download all the files.  so when i go into itunes now and check for updates it says its up to date.  the problem is with the phone support file i didnt download. 
    Does anyone know how to get back to the pop up that has the music player update and itunes update bc this is the only place i have seen "tools" to be able to manually update all four files....
    ***IF i completely uninstall itunes and reinstall will it still have all my songs, photos, apps etc... bc i need to sync my new phone to get all my stuff back

    this is a follow up from the profane post earlier....
    i have done this twice in two other posts..
    here is my problem.. i started off trying to update itunes, it failed twice and said i needed to install manually via tools.
    the only place to get to tools is the pop up box that appears when you click check for updates.. if there is an available update then the pop up shows up with the quick time and itunes files to download. so i finally figured that out. i clicked on tools and manual update, four files were saved to a file. Apple mobile device support, another one similar, itunes, and another one i cant remember. I only downloaded the itunes file seeing as though thats all i needed to accomplish in the first place.
    so then i restarted my computer bc you need to reboot and then reopen itunes for update to take effect. once i have itunes back open i plugged in my new 5s which i am trying to sync to my computer to get all my stuff back bc i lost my previous phone over the weekend.. once i plugged the phone in an error stating i needed to unistall the apple mobile device support and itunes and then reinstall. well i dont know where those files were originally stored on my computer AND since my itunes was updated, just not the other 3 associated files, when i click check for updates it says its up to date and then pop up containing the quick time and itunes does not pop up thus i cant get back to the tools tab to manually save the 4 files again.
    so i was just going to uninstall itunes all together and then i thought well what happens if it erases all my photos apps songs etc... which would defeat the whole purpose in the first place of me trying to sync my new phone to get all my stuff back.
    so i literally have no idea what to do at this point.. if you have read this you are probably just as confused as me...

  • HOw to get rid of the borderline in the  render list item of the news brows

    HI,
    HOw to get rid of the renderlist
    border line,
    Give Feedback  link   
    Send To  link in the news browser.
    After removing thiese things, it should look like a normal html page .
    how to  achive this ,
    if coding required then which is the par file I need to modify
    thanks
    pkiran

    Hi PKG,
    the "GiveFeedback" and "SendTo" links are called "FlexUI" commands. Most of that stuff is highly configurable and naturally you can remove them in the KM Configuration at
    SystemAdmin->SystemConfig->KM->CM->UserInterface
    -> ... -> ResourceRnderer
    Your ResourceRenderer uses a CommandGroup. In this CommandGroup you can add/remove commands.
    For example un your case its the CommandGroup "NewsDisplayGroup"
    Kind Regards
    --Matthias

  • How to get rid of the Login page in Portal?

    Hi Guys,
    I have a newly developed intranet portal project for my company which does not need login no more. I hope you can help me how to get rid of the login page in portal which is I know in every application you create, there should be a login. Is this possible that I can just simply type in to the URL address bar my application then it will no longer ask for any logins? Please help! Many thanks!
    Russel

    Hi Russel,
    You can give public access to pages, applications etc. Users won't need to supply a username/password then, while you still can hide some of the pages to authorized people.
    Check the access tab for pages and the manage tab for applications.

  • In Lightroom mobile how can move photos within the collection????

    In Lightroom mobile how can move photos within the collection????

    What you can do is to move (or copy) a photo form one collection to another. This can be triggered via the top right app menu item from grid view. Same menu is available when you open up an image for editing. Hope that helps. -Guido

  • How to get rid of the black border around the artboard

    Hopefully my last question for tonight.
    I need to get rid of the black border around the artboard. The two images show my drawing lined up with the art board and then inside the artboard. The dark gray is not the artboard.
    As you see, the artboard has a black border. I need to get rid of it. It shows up in my project when my color key is green. The black won't go to transparent.
    So how-to get rid of the border? Thanks
    ***Update***
    I figured it out. View > Hide Artboards. Maybe this will help someone. Doesn't change the fact my spider looks like a tick:)

    Doesn't change the fact my spider looks like a tick:)
    Try to get hold of a real spider and take a look at its anatomy, specially where the legs sprout from :-)

  • How to get rid of the old songs from iPhone that do not show up in iTunes?

    Every time I delete my entire iTunes library and sync iPhone with it, my music is still loaded with old songs but do not appear on my iTunes. And when I add new songs to my library, the new songs get mixed with old songs.
    How to get rid of the old songs?

    hey buddy....u have to delete the songs from ur iphone....i have got the same issue.....songs are not showing in itunes!!!!!

  • How to get rid of the "time out" when using DAQ AI in the example program

    I try an example file called "AcqVoltageSamples_IntClkDigRef" (Visual C++ .NET). It works great. However, if the program has not recieved the data, it sent out a timeout message. How to get rid of the "time out"? I cannot find anywhere in the code. Is this a property I have to reset somewhere else?
    Thank you,
    Yajai.

    Hello Yajai,
    The example program will use the default value for timeout, 10 seconds. To change this, you will have to set the Stream.Timeout value. I inserted this function into the example and set it equal to -1, and the program will wait indefinitely for the trigger signal without timing out. Please see the attached image to how this was implemented.
    I hope this help. Let me know if you have any further questions.
    Regards,
    Sean C.
    Attachments:
    SetTimeout.bmp ‏2305 KB

  • How to get rid of the main text box in the back of the page AND move things

    I usually work in Adobe Illustrator, Photoshop, and InDesign, but am creating two newsletter templates in Pages for a colleague, since it will be easier for her. But, for the life of me, I can't figure out how to get rid of the main text box in the back of the page that is driving me crazy. I just want a nice blank page that I can do whatever I want with. AND, I can't figure out how to select things so that I can move them, like shapes and text boxes. Some things seem to move fine, then other things just sit there. I am at the end of my rope!!!

    Hi, Dylan. Welcome to Discussions.
    If you're referring to the area where you just start typing when you open a new blank document, you can't get rid of it. But you also don't have to use it. You can insert text boxes and size and position them as you desire. Just be sure they're defined as Fixed on Page. When one is full and you want to continue it to another page (or to the side), click in the blank blue box on the lower right side of the text box. That will create another box and your overflow text will flow into it. Then position it where needed.
    Also, you can create a text box the width of the page and then set it for 2 or more columns.
    When you want to send something to the back and you may want to access it again later, just use the send backward command. If you send it all the way to the back, it will be behind the main text layer (where it will be safe from acvcidental movement) but you will have to click outside the work area and then drag the pointer to the object to select it.
    Hope this helps to get you started.
    Walt

  • How to get rid of the message Client submission probe stuck in the Exchange Server Queue?

    We have Exchange 2013 in Hybrid with Office 365.
    How to get rid of the message in the Exchange Server Queue?
    Mounting the database fixed it.
    Thanks!!!

    Mounting the database fixed it.

  • How to Get Rid of the Extra cents left on your gift Card balance?

    I would very much like some help on how to get rid of the 65 cents I have left in my itunes account, without having to spend it on something, or make a new account, or contact Apple. Please someone help with this, I'm sure many other are having trouble as well!!!!

    I noticed there is an extension which lets you clear the title of the current page or replace it with other text. This seems to work equally well in private and non-private windows, however, it doesn't appear to have an option to automatically do it in all private windows. Maybe someone can add that feature (the author isn't maintaining the add-on any more).
    https://addons.mozilla.org/firefox/addon/page-title-eraser/

Maybe you are looking for

  • Attached iPod to TV but not getting any audio

    I attached iPod to TV via Apple's digital A/V adapter and HDMI cable.  The video works great but I am not getting any sound. My tv is a samsung smart tv and I also have a samsung home theater system. I even turned of the home theater system completel

  • [svn] 2263: Fixed WiseUI performance app and some mustella test failures.

    Revision: 2263 Author: [email protected] Date: 2008-06-26 13:19:12 -0700 (Thu, 26 Jun 2008) Log Message: Fixed WiseUI performance app and some mustella test failures. tests Passed: checkintests Needs QA: YES Needs DOC: NO Bug fixes: API Change: NO Re

  • Java Applet Disappears From Website

    When I add a java applet to my web site on .Mac (inside the proper folder on my iDisk), it will run for awhile, but then will disappear. What is happening?

  • How can I get an email contact to return my Airport Extreme Base Station?

    Just bought it on line a couple of weeks ago, and as seems to be the case with everyone else here it just has never, ever worked right. Dropped signals, failure to renew DHCP's etc. Make a long story short, I unlugged it, went back to my old Airport

  • Ordering Rows in DB Adapter

    Hi , We are using SOA suite 10g. In one ESB we have a DB Adapter which inserts into an interface table in oracle 10g database. (R12 EBS) Database Adapter's operation type is 'Perform an Operation on a Table/Insert or Update(Merge)'. XML payload has f