Helps summarizing a series of numbers

Hello
The following SQL code shows the output as

450039 - 450090
450041 - 450041



WITH wsh_Serial_numbers as
(select
72016 delivery_detail_id, fm_serial_number 450039, 450039 to_serial_number of the double
Union of all the
Select 72016, 450040, 450040 Union double all the
Select 72016, 450041, 450041 of all the double union
Select 72016, 450089, 450089 of all the double union
Select 72016, 450090, double 450090)
SELECT from_num |' -' || to_num Serial_Numbers
Of
(
WITH all_data1 AS
(
Delivery_detail_id SELECT detail_id,
fm_serial_number f_serial_no,
to_serial_number t_serial_no,
NVL (Lead (fm_serial_number) over (partition BY order of fm_serial_number delivery_detail_id) - fm_serial_number, 1) drive
-NVL (fm_serial_number-Lead (fm_serial_number) over (partition BY order of fm_serial_number delivery_detail_id), 1) drive
OF wsh_Serial_numbers all_data1
WHERE delivery_detail_id = 72016 - p_delivery_detail_id
ORDER BY delivery_detail_id
)
SELECT detail_id,
MIN (f_serial_no) FROM_num,
Max (f_serial_no) TO_NUM
Of all_data1
GROUP BY detail_id, lead
ORDER BY MIN (f_serial_no)
)

But the aim is

450039 - 450041
450089 - 450090

Could someone suggest how to achieve this?

Kind regards
Srini

After the Oracle version, the definition of table and extract of code that you have run with error messages. I modified the solution for "fm_serial_number and to_serial_number are of type VARCHAR2. To try:

WITH wsh_Serial_numbers as
( select
'72016' delivery_detail_id , '450039' fm_serial_number, '450039' to_serial_number from dual
union all
select '72016' ,'450040', '450040' from dual union all
select '72016', '450041', '450041' from dual union all
select '72016', '450089' ,'450089' from dual union all
select '72016' ,'450090' ,'450090' from dual )
select  delivery_detail_id,
        min(fm_serial_number)  min_fm_serial_number,
        max(to_serial_number)  max_to_serial_number
  from  (
         select  delivery_detail_id,
                 fm_serial_number,
                 to_serial_number,
                 sum(start_of_group) over(partition by delivery_detail_id order by to_number(fm_serial_number)) grp
           from  (
                  select  delivery_detail_id,
                          fm_serial_number,
                          to_serial_number,
                          case to_number(fm_serial_number)
                            when lag(to_number(to_serial_number)) over(partition by delivery_detail_id order by to_number(fm_serial_number)) + 1 then 0
                            else 1
                          end start_of_group
                    from  wsh_Serial_numbers
                 )
        )
  group by delivery_detail_id,
           grp
  order by delivery_detail_id,
           grp
/ 

DELIV MIN_FM MAX_TO
----- ------ ------
72016 450039 450041
72016 450089 450090

SQL> 

SY.

Tags: Database

Similar Questions

  • Hello, I agree with Adobe. I reconfigured my Apple and reinstalled Adobe. But I can't not find my applications (photoshop/lightroom). I wonder for my series of numbers, I can't find. Please help me...

    Hello, I agree with Adobe. I reconfigured my Apple and reinstalled Adobe. But I can't not find my applications (photoshop/lightroom). I wonder for my series of numbers, I can't find. Please help me...

    If you have CC desktop application installed and then try to connect and insert it again.

    Otherwise, install as you did initially.  Download/install the desktop application, connect and install applications subscription.

    Creative cloud to desktop
    https://helpx.Adobe.com/creative-cloud/help/creative-cloud-desktop.html

    Sign out, sign in | Creative office cloud app
    http://helpx.Adobe.com/creative-cloud/KB/sign-in-out-creative-cloud-desktop-app.html

    Install, update, or uninstall applications
    http://helpx.Adobe.com/creative-cloud/help/install-apps.html

  • I reinstall my windows. I need to reinstall my Lightroom5 and I can not find my serial No.... Please help find my series. Thank you

    Please help find my series. Thank you

    Hello

    Please check the help below document:

    Quickly find your serial number

    In the case of the volume license product, please visit: site Web of Adobe License | Serial numbers | Orders | Accounts

    Kind regards

    Sheena

  • I bought the first elements 13 and 13 Photoshop elements according to a trail. I received 1 set of serial numbers to activate Photoshop and 2 sets for first. However, after you type in the first series of numbers for the first, there was no place to type

    I bought the first elements 13 and 13 Photoshop elements according to a trail. I received 1 set of serial numbers to activate Photoshop and 2 sets for first. However, after you type in the first series of numbers for the first, there is no place to type in the second set. How can I check if the first has been correctly activated?

    You get usually just a serial number by program... a list of 24 numbers, 6 sets of 4.

    Click the icon of the program and see if it boots without asking for a serial number.

    If it is not running now, please contact support:

    To contact support, please click the link below, click on the still need help? option in the blue box below, then choose the cat. Make sure you are signed in with your Adobe ID, have cookies enabled and have deleted your cookie cache.  If you have any questions, try another browser.

    Serial number and activation support

    Guinot

  • Strange series of numbers in previous winners

    I realize that the previous winners are not really deleted when you remove and somehow always some completely unknown addresses are involved in Mail, but the number in iMessage series are absolutely inexplicable. Someone has an idea to this subject or know where the numbers come from and what they do?

    This happens on OS X, as long as iOS, each with the latest updates and iCloud activated.

    Hello

    In Britain, where I live, there are more numbers to Contacts info.

    Obviously a country Code (+ 44 in my case).

    In the case of an iPhone, there is "indicative" of the carrier (7973 for example) and then the last six digits of the real number

    If I was using fixed lines, I have a lot of friends and family with the same area code, so I would only store the last six digits.

    After that if the Contacts App is not synchronized with another device correctly that the numbers appear.  (On Mac)

    However, your photos appear to show that the 'last message' which is normally known as (where your watch as many) then shows the number instead of the last Message.

    Have you had the problem with the iOS 9.3 update that did not work properly on old iPhones?

    Have you used the updated supplement or did you go directly to iOS 9.3.1?

    21:42 Sunday; 3 April 2016

     iMac 2.5 Ghz i5 2011 (El Capitan)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro (Snow Leopard 10.6.8) 2 GB
     Mac OS X (10.6.8).
     a few iPhones and an iPad

  • Lightroom series/registration numbers

    I just got my new Macbook with Mountain Lion retina.  I used Migration Assistant to put all my files and applications on the old Macbook.  I opened Lightroom 3 and introduced to the screen to buy / register.  Entered my serial number and used LR.  Everything works great and the screen is fantastic!  It is, every time that I reopen it LR, I have to go again serial numbers.  What should I do to not have to do it every time.  I tried to re - register, but that did not help.

    http://forums.Adobe.com/thread/358043

  • produce a series of numbers to select from the shortcomings of the ID column

    (1)

    Suppose I have a table t that contains lines like this:

    A AND B
    ---------- ----------
    2 4
    6 7

    I would like to use select to produce lines with numbers between a column and column B included
    for each line, like this:

    Select from t...

    2
    3
    4
    6
    7

    (2)

    Suppose I have the ID column that is lacking, I want to get the lowest < N > numbers available between the gaps.
    I did some research and I can find the range of gaps, but I can't get the numbers listed separately, therefore
    I ask the question (1). But is there a direct way for the list instead of going through beaches and the list.

    For example, I have the ID column that has

    2
    5
    6
    7
    9
    2000000

    I would get a select query that produces

    Select...

    3
    4
    8
    10
    11

    I have a way to get a list of 2 to 2000000, then less than what we need to get all the
    numbers of the gap, but who is not effective and may is short-term memory.

    PS: before I post on this group, I did some research already on "connect by", with recursive queries.

    PuraVidaOTN wrote:

    I would like to use select to produce lines with numbers between a column and column B included

    for each line, like this:

    Assuming that no duplicates in the table...

    with t as
    (
     select 2 c1,4 c2 from dual union all
     select 6 c1,7 c2 from dual
    )
    select c1,c2,c1+level-1 c
    from t
    connect by c1+level-1 <= c2
    and prior c1 = c1
    and prior c2 = c2
    and prior sys_guid() is not null;
    
    C1 C2 C
    -- -- -
     2  4 2
     2  4 3
     2  4 4
     6  7 6
     6  7 7 
    

    Suppose I have the ID column that is lacking, I want to get the lowest numbers between the gaps.
    I did some research and I can find the range of gaps, but I can't get the numbers listed separately, therefore
    I ask the question (1). But is there a direct way for the list instead of going through beaches and the list.

    I have a way to get a list of 2 to 2000000, then less than what we need to get all the
    numbers of the gap, but who is not effective and may is short-term memory.

    It's the best way in my opinion...

    Or rather less, you can try outer join...

    Published by: JAC on December 19, 2012 21:28

  • Question about series/authorization numbers

    Hello. I am trying to install Photoshop Elements on my new computer. I installed it on a computer already, but I deleted the operating system and sold this computer.  Then I tried to install it on another computer, but unfortunately, the operating system was too old to be compatible with Photoshop.  Because it did not work, I unfortunately just deleted the program from that computer without uninstalling.  Now I want to install Photoshop Elements on my new computer, it doesn't let me, as I have already installed twice and need to uninstall on one computer.  But unfortunately, for the reasons that I have just given, is not possible.  Can you please help?  Thank you!!!

    Hi Iltink,

    Please see the knowledge base article: http://helpx.adobe.com/x-productkb/policy-pricing/error-activation-limit-reached-starting. html.

    Kind regards

    Romit Sinha

  • Creative cloud wonder series/product numbers?

    Yesterday, I ordered a subscription cloud creative and when I want to start programms/apps ask series/product number?

    This is not good then, how can we fix this because I need the programs today.

    Best regards

    André Willemsen

    Hello Akshay,

    I came to your technical/customer support by twitter and the problem is solved. I can use all programs.

    Thumbs up for customer Adobes.

    André

  • Need help with cataloguing series Mac prelude

    I am trying to sort the serials of my business and add them to a database for our Mac technicians in case of emergency. Does anyone know what the first four digits are in a series of prelude Mac please? We have a mixed Mac and Windows desktop configuration. I don't want to mix the serials Mac and Windows. I realized most of the Mac Adobe series we have. I know our Acrobat X series begins with 1118 and Fireworks is 1193.

    Thank you.

    Someone can close this issue. I found the answer the hard way using the installer for Prelude and try my list of publications in series, until I got a green check mark. At least I can finish my work before the staff of back on Monday and I don't have to wait on buying service picks up or unnecessary personal Adobe.

    Thanks for nothing with such a simple question.

  • Help with multiple series

    Hey all,.

    I am trying to add a series of line to an areaChart (Cartesian actually)

    I can easily add the second series via action script or tags.

    The problem occurs when I try to update the series online. Each time series of line data are changed the main series of plot runs its animation (slide).


    Is it possible to update the series line without enacting the plotseries animation?

    Solved.

    What I did to remove the animation from the series, whenever the line series was created.

    Because the data in the chart could change only when a user moves a slide I added animation when the mooused of the user down on the slide.

  • All of a sudden make a long series of numbers and alphabet which absorb a page... under summer receipt, DKIM-Signatures. How to disable that?

    Line X-originating-IP, long categories and alpha & digital + Word comments usually I see and do not want to see.
    How can I disable for the info display "normal"?

    View (Alt - V) - headers - Normal

  • Question about type of Satellite A200 series model numbers

    Look at me, toshiba satellite a200 - 1 m 7, and what this way: PSAE0 PSAE3 PSAE6 PSAEC how to learn of me who could download correct driver... Thank you!

    Hello

    Just look at the STICKER on the BOTTOM of your machine. On this vignette is the type of model number, your configuration and serial number.

    So if you want to download the correct drivers then watch the SILVER STICKER and you will get the model number (PSAExxx)

    Welcome them

  • help desk jet series 6210 need to change region code

    I have a 6210 printer office jet purchased in South Africa. Must be able to use in the United States with wagon no 94 / & 95 but I need to change the region code.

    Is your printer still in the period of one year standard warranty?

    Contact HP Total Care. A service representative will be able to guide you through a change of region by telephone.

  • Box of custom need to add text - format ' / time "after a series of numbers.

    Simple question that I don't know how to do. I need a particular text box to display "/ hour" or "per hour" after I typed an hourly rate (for example 25,50).

    Is it possible to do?

    For example, typing "25,50" would produce "$ 25.50 / hour.

    In second thought it is not that complicated... This code should do the trick:

    if (event.value && !isNaN(Number(event.value))) event.value = "$" + util.printf("%.02f", Number(event.value)) + " per hour";
    

Maybe you are looking for