Partition by without sorting groupings?

Hi,
I have a problem where I have to use a function like the row_number() function but when I do my groupings I don't want to reorder the whole table.
So the result I want is in the sequence column of the table below:
sites
signal
date
sequence
site1
alarm
2014-05-14 12:00
1
site1
alarm
2014-05-14 12:30
2
site1
noalarm
2014-05-14 13:00
1
site1
noalarm
2014-05-14 13:30
2
site1
noalarm
2014-05-14 14:00
3
site1
alarm
2014-05-14 14:30
1
site1
alarm
2014-05-14 15:00
2
site2
alarm
2014-05-14 12:00
3
site2
noalarm
2014-05-14 12:30
1
site2
alarm
2014-05-14 13:00
1
site2
noalarm
2014-05-14 13:30
1
site2
noalarm
2014-05-14 14:00
2
So to desribe what I am trying to do,I want to group by sites order by date. Then I want to sequence the signals, retaining their date ordering.
How can I do this?
Thanks

Thanks, however, if I try that the sequence doesn't 'reset' so I get the result below:
sites
signal
date
Seq
site1
alarm
14/05/2014 12:00
1
site1
alarm
14/05/2014 12:30
2
site1
noalarm
14/05/2014 13:00
1
site1
noalarm
14/05/2014 13:30
2
site1
noalarm
14/05/2014 14:00
3
site1
alarm
14/05/2014 14:30
3
site1
alarm
14/05/2014 15:00
4
site2
alarm
14/05/2014 12:00
1
site2
noalarm
14/05/2014 12:30
1
site2
alarm
14/05/2014 13:00
2
site2
noalarm
14/05/2014 13:30
2
site2
noalarm
14/05/2014 14:00
3
Here's the create data if that's useful.
Thanks
create table myTable2 (
sites varchar(50) NULL,
signal varchar(50) NULL,
[date] datetime)
insert into myTable2(
sites,
signal,
[date]
values 
('site1','alarm','2014-05-14 12:00:00.000'),
('site1','alarm','2014-05-14 12:30:00.000'),
('site1','noalarm','2014-05-14 13:00:00.000'),
('site1','noalarm','2014-05-14 13:30:00.000'),
('site1','noalarm','2014-05-14 14:00:000'),
('site1','alarm','2014-05-14 14:30:000'),
('site1','alarm','2014-05-14 15:00:000'),
('site2','alarm','2014-05-14 12:00:000'),
('site2','noalarm','2014-05-14 12:30:000'),
('site2','alarm','2014-05-14 13:00:000'),
('site2','noalarm','2014-05-14 13:30:000'),
('site2','noalarm','2014-05-14 14:00:000')

Similar Messages

  • Subtotal in ALV without sort technique to maintain heirarchy of records.

    Hello Abappers,
    In my functionality, i want to perform subtotals of the expenditures of a particular SBU. So in the ALV under each Business Unit, there are various Expense types and under them various SBU's
    Heirachy is as follows :
    BU - > Expense Type - > SBU
    So when i display all this in ALV,
    column A is BU
    column B is expense types under one BU
    column C is SBU's under one expense type
    column D is the amount expenditure of SBU
    I want a subtotal of amounts spend under one expense type. i.e sum of all SBU expenditure and then total of all expenditure. Total i can get by do_sum in fieldcatalog.
    But for the subtotal, i need to use sort criteria, but if i sort entire thing gets sorted and the heirarchy is lost.
    Is there any other way of performing subtotal without sorting?
    Regards.

    hi.
    i think before showing the itab in alv , u should also calculate the subtotals in it.and then sort it out and send to alv.

  • Deleting Duplicate from ITAB without sorting????

    Hi,
    A challenging and interesting problem please help. I want to delete duplicates from an ITAB without sorting (so cant use delete adjacent duplicates)
    data:  begin of dpp occurs 0,
            val type i,
            end of dpp.
            dpp-val = 13.
            append dpp.
            dpp-val = 15.
            append dpp.
            dpp-val = 26.
            append dpp.
            dpp-val = 15.
            append dpp.
            dpp-val = 27
            append dpp.
            dpp-val = 15.
            append dpp.
    As you see 15 is duplicated in DPP,,,how can duplicated 15 entries be deleted without sorting
                       VAL
         13
         15
         26
         15
         27
         15
    thhnx
    Edited by: Salman Akram on Oct 12, 2010 3:54 PM

    Hi,
    Loop through your DPP itab then append to another. try this:
    DATA: BEGIN OF dpp OCCURS 0,
    val TYPE i,
    END OF dpp.
    dpp-val = 13.
    APPEND dpp.
    dpp-val = 15.
    APPEND dpp.
    dpp-val = 26.
    APPEND dpp.
    dpp-val = 15.
    APPEND dpp.
    dpp-val = 27.
    APPEND dpp.
    dpp-val = 15.
    APPEND dpp.
    DATA: BEGIN OF dpp1 OCCURS 0.
            INCLUDE STRUCTURE dpp.
    DATA: END OF dpp1.
    LOOP AT dpp.
      READ TABLE dpp1 WITH KEY val = dpp-val.
      IF sy-subrc NE 0.
        APPEND dpp TO dpp1.
      ELSE.
        CONTINUE.
      ENDIF.
    ENDLOOP.
    REFRESH dpp.
    dpp[] = dpp1[].
    thanks.

  • Code for find the missing number in array without sorting/comparing in java

    Hi all,
    We have 1 to 100 number in an array, but one number is missing (from 1 to 100). we have to find it out without sorting or comparing of this missing number in array.
    please help me out to find the solution this query.
    regards & thanks
    Mohan Kumar
    Bangalore,
    India

    Maybe you could sum up the numbers you've got in your array and subtract the result from 5050 [the term [code](N*N+N)/2 where N is your upper bound (i.e. 100)]. You'll get the sum of all missing values (which in this case would be exactly the missing number). n.b. that you could genaeralize on that for arbitrary finite series.
    Kind Regards,

  • Changing partition size without reformatting drive?

    I heard a rumor that in Leopard you can change the size, name, or other details of a partitioned HDD without having to erase and reformat it.
    Is this correct? If so, that would be a huge advantage for me, as I often don't predict how much drive space I'll need to use.

    Tell me if I'm wrong, though, but it seems that DU can only shrink. So, if you have 2 partitions, after you shrink one, you can't increase the size of the other. I hope I am wrong here. Please let me know if your experience is different. I think we'd all like to know how it goes, regardless.
    That said, VolumeWorks can do as you require. DO NOT do this without a backup of everything.

  • Format and partition HD without external drive - how to...

    Just got a new previous gen imac and before I start saving stuff, I want to partition the drive. I'm thinking this can be done with the install disc. I'm wanting to make a partition for a Superduper Sandbox, and a scratch disc for photoshop. Is there specific directions for doing this without an external drive anywhere?
    I'm not sure how important it is to have a scratch disc as I'll have 3gb ram, and I'll leave a lot of free space....any thoughts on this?

    You can do it from the install disk by booting from it then instead of doing an install select a language and then, go to the utility menu and select "Disk Utility". You can then create the partitions you want, name then, and decide the size of them. After that you will have to install a new OS. Remember that doing all of this will erase the drive, so if you have any data on it you want to keep you need to get it of first.
    Mac Help can guide you through this process. You could also open up the Disk Utility application which is in your utilites folder and use those application specific help files. I am making this sound complicated but really, it is not.

  • Sort a Stack, without sorting entire Album

    Is there any way to sort a Stack (by rating for example) without affecting the sort order of the test of the Album?
    Grant

    Have you tried using Compare mode and promoting and demoting for ranking stacked images?
    In practice I find Compare mode clumsy (for several reasons). I usually make Stack picks either in Split view, with the Browser set to grid (not filmstrip), or I just constantly click back-and0-forth from Browser in Grid view to Viewer in Show Multiple view.
    My general method is to make Stacks in a Project, then make Stack selections, then make Project selections. (This requires some discipline -- I always want to go straight to making Project selections.) My workflow is
    - Create and describe Project
    - {Apply Keywords}
    - Make Stacks
    - Make Stack picks. Collapse all.
    - Make Project picks
    I, too, have stumbled over the lack of a Stack-specific rating system. (In my implementation, star-ratings are used to rank images within a Project. I use keywords for Library-wide rating, e.g.: "Portfolio". And I use stacks only for variants of images, e.g.: different f-stops, rapid-fire wildlife, etc.) There are several work-arounds. Sometimes I select from the Browser the best candidates and drag them to the top of the stack. Sometimes I attach a temporary star-rating which I remove once I've made my Stack pick.
    HTH -- gotta run.

  • Changing Partition Size without Deleting (bootcamp)/ Vista Question

    Hi, I'm currently running windows xp and OSX together with bootcamp on my black macbook (2 gigs of ram).
    I want to install Vista but I don't have anymore space on the Windows XP partition (just 4.42 gigs left). Can I partition my drives again where I get more room for my XP drive without deleting or messing up any of the information?
    Also , can I even use vista ultimate upgrade on my macbook?

    Hi,
    I believe boot camp is not supporting upgrade version of windows OS.
    Run you boot camp assistant to changed the partition size, but I think it will delete all of the XP that already installed there, but you don't need that again if you want to install Vista in that partition right?
    do visit boot camp forum for more answer from their experienced user.
    Good Luck

  • Bootcamp Partition option without option key?

    I work for a school division where we have dual boot macs in some of our schools. Many of the younger students have difficulty figuring out which key to press (option key) in time to bring up the boot partition option screen. I know it sounds strange, and when we started I didn't think it would be a big deal. But I have spent many hours in the classroom with them and sometimes they have to restart 3 or 4 times before they get it right.
    I am wondering if anyone out there knows of a way to have that option screen displayed automatically, without having to hold down the option key at startup. I have found rEFit (http://refit.sourceforge.net/) but our tech support team says they only want to use Apple supported software and hardware in the schools.
    Is there an Apple supported way of bringing up the boot partition option screen automatically without having to hold down the option key?

    Sorry, I maybe wasn't very clear about who was going to be doing this. These are students in an elementary school, which means they are as young as 5 years old. They don't know how to read, and some don't even know their letters yet (which makes logging in a challenge as well, lol). Going into a control panel and changing the boot sequence is not an option.
    I realize some of you may have kids of your own who are whizzes on the computer. But teaching one student how to hold down the option key when the computer boots at home is very different from teaching a class of 20 of them in a lab setting. Class time is precious, so the easier we can make it for them, the more time we have to devote to using the computer as a tool to teach them things like the letters of the alphabet.
    Remember, many of the teachers who are teaching these students are not used to using the computer as a teaching and learning tool. For some of them, they only thing they have used a computer for is word processing. It is new ground to them. So if they get flustered because the computer keeps booting into the wrong OS for some of their students who don't hold the option key quick enough, they may get discouraged and decide that it isn't worth taking their class down to the computer lab and they would rather teach using the paper and pencil method. This is not the biggest problem we face by far, but the little things can add up. I'm just trying to give them as much support as I can to make the transition smooth for them.
    That's why I wanted to have a boot option screen where they could either use the mouse to click a picture. If we could simply set bootcamp to bring up the option screen by default, that would solve the problem for me.

  • Changing the partition format without reinstall the Mac OS X

    Hi,
    Does anyone know how to change the file system format of the partition without needed to reinstall the OS X ?
    E.g. "Mac OS Extended (Journaled)" > "Mac OS Extended (Case-sensitive, Journaled)"
    this link will give an idea of list of file system format available http://images.macworld.com/images/legacy/2006/10/images/content/pickformat.jpg
    The main reason I need this is because of I wish to avoid reinstallation as it take time to install and update to latest patch...
    I have MacBook with 3 partitions with formated to "Mac OS Extended (Journaled)" on all 3 partitions. 1st and 2nd partition installed Mac OS X 10.6 and 10.7, and created an image (by using carbon copy cloner) for each partition and saved it into 3rd partition as backup.
    I tried to below but it doesn't help:
    1. Boot into 10.7.
    2. Erase the 1st partition 10.6, reformat it to "Mac OS Extended (Case-sensitive, Journaled)".
    3. Restore 10.6 image that created previously.
    4. After restore completed, the 1st partition file system format back to "Mac OS Extended (Journaled)".
    Is there's anyway to change the partition file system format without needed reinstall Mac OS X ?

    Or is there any backup tool that it will only back file and folder level but not file system format ??
    That what all backup tools do.
    If so, then I can create a backup image of the existing entire partition file and folder only, then reformat the partition to case-sensitive, then restore back the file and folder...
    Yes, that's what I'm suggesting. Be aware that it's a one-way conversion. Once you have a case-sensitive file system, you generally can't go back to case-insensitive without losing data. I hope you have a good reason for wanting to do this and that you know how to deal with the problems it may cause.

  • Reinstall Mac OSX on partitioned drive without losing Windows data

    Several weeks ago, I used bootcamp to partition my mac so I could install Windows. I set aside about 20GB for Windows. I did it so that I could download a program I need to take the bar exam.
    Everything worked fine for about a week. Then my "mac hard drive" started running slowly, freezing and crashing where I had to do manual restarts. The windows hard drive worked fine. Then, my mac hard drive quit starting up completely. It would freeze on the grey/blue screens.
    Went to a mac store. The guy didn't know what to do (because he wasn't trained in boot camp) but told me I could try doing an install-without-erasing of Mac OS on the mac hard drive. I did this, and it helped, but did not solve the problem. It still froze/was slow.
    Now, the Mac hard drive doesn't completely start up, it freezes after I enter my log in information.
    I want to know the following: If I do a complete reset/reinstall of the mac OS on my mac hard drive, will it affect my Windows hard drive? I ABSOLUTELY CANNOT lose the program I have installed on my Windows hard drive. However, I am a bit nervous that if I don't take any action now, whatever problem is occurring may seep over into my Windows hard drive.
    Any advice would be wonderful. Thanks!
    Message was edited by: khiner
    Message was edited by: khiner

    you could use [Winclone|http://twocanoes.com/winclone> to clone the winsloth partition to an external, then erase your internal drive, reinstall OS X, have bootcamp assistant create a new partition for winsloth, and finally clone your winsloth installation back.
    JGG

  • Converting ext disks to GUID partition scheme without erasing

    I've got a few external hard drives that I've been using for a few years, and I just tried to encrypt them...only to be told by OS X that they need to have the GUID partition scheme. Is there a way to give them this without erasing their contents? They're big drives and close to full. Most of them are backup drives, so I'd really prefer not to erase them, nor do I want to buy a new drive just to use as a copy machine.

    Unfortunately, you do need to erase the drive to partition GUID
    http://support.apple.com/kb/TS1600

  • Partition shared without being specified in system preferences ...

    Hi,
    I have a MacBook Air and an iMacIntel.  In both, File sharing is activated but no specific folder is chosen to be shared. How can I be able to see my iMacIntel partitions or hard disk on my MacBook Air and vice versa.
    Over time, I probably made choices that explains this, but I don't remember niether do I understand the logic of being able to see those partitions even if they are not specified.
    Do you have a clue ?

    Hi LousyFool,
    I think I see were you are getting at.  On the MacBook Air, I am connected to my iMacIntel as an iMacIntel user and vice versa. 
    Could this be related to a previous connection where I would have added this to the Keychain, explaining then the automatic mounting of these partitions ?

  • Adding more space on a partitioned drive without losing data

    I have just partitioned my harddrive to put Windows XP on it ... but I underestimated how much space I needed. Is there any way to add more space on this partition with out losing any of the data on it? I tried using iPartition, but it's not free.
    Any ideas?
    Thanks

    No. You can only manage a Boot Camp partition with Boot Camp Assistant. Unfortunately, Boot Camp Assistant does not have a facility for resizing a partition. You would first have to remove it, then repartition to the desired larger size. Of course everything will be lost on the partition. You can use a Windows backup utility to backup your files then restore them after you reinstall Windows on the larger partition.
    If you were to use a utility like iPartition (and I don't know if it will re-size the Boot Camp partition) you may find that you can no longer remove the partition with Boot Camp.

  • Create Boot camp partition on multiple partitions disk without reformatting

    Hi everybody,
    I am trying to install Windows 7 on a multiple partitions 1TB disk.
    Currently I have 2 partitons:
    300GB - OS X Lion
    700GB - Data
    I have read some tips and advices on how to install windows on multiple partitons disks - most of them are invasive (backing up to a removable drive and then reformatting). However, I haven’t found conclusive answer (hence my posting here):
    I’m wondering does anybody know in any way - is it possible to do this more painlelssly - to divide second partition (or maybe first) and use that one as a bootcamp target?
    Or am I stuck with reformatting to a single partition and then installing from scratch?
    Thank you.

    No. To use Boot Camp Assistant your drive must start with a single volume encompassing the entire drive - one partition. BCA will then create a second partition for Windows and modify the bootloader so you can select which volume to use for startup - OS X or Windows. BCA can also remove the Windows volume and restore the drive to its original state - single OS X partition.
    If you have more than one partition already then BCA cannot modify it. If you have a drive configured with BCA and subsequently add a third partition then BCA is no longer able to manage the drive, and you may no longer be able to boot Windows because of changes made to the bootloader.
    So, yes, you are stuck with "reformatting to a single partition and then installing from scratch."
    Your alternative is to create however many partitions you want. Install Windows on one of them. Download rEFIt to replace the standard bootloader so you can select between Windows and OS X (or any other OSes you install.)

Maybe you are looking for

  • How can I implement this with CWGraph control?

    Who can help me,i meet a difficult problem: Now i have a form(historygraph.frm), four DTPicker controls(DTPicker1,DTPicker2,DTPicker3,DTPicker4), and three command control(cmdFind,cmdNextPage,cmdPreviousPage). My database is SQL SERVER 2000, In my ta

  • Can't Publish from Robohelp HTML 7 to Robohelp server 8

    Please help. I have looked everywhere for answers. Here is my problem. Environment I have a windows XP machine with robohelp html 7 and the 7.0.3 patch installed. I am testing the trial version of robohelp server 8 for 30 days. The installation of th

  • Print Correspondence in F.61 versus send email.

    When I use f.61 for certain documents, it triggers an email instead of a printout.  Where is the configuration or setup that controls whether or not a correspondence is printed or emailed?

  • Scan with Image Capture freezes OS

    Since I updated to Mavericks the system freezes when I scan in Image Capture. This occurs with two different scanners, a Epson Perfection V30 and a Lexmark X364dw. When I start the scan in Image Capture it seems to work. Then Image Capture shows the

  • How to create AWs in 9iOLAP

    I need to create an AW for a demo using 9iOLAP. Can any one pl guide me on the steps required to get started. I have downloaded the AWM v 9.2.0 client on my laptop. Most of the published documentation is for Rel 10g, there is hardly any for 9i. Any h