Compare the record previous and next in a table

I have the dataset that looks at below:

Name | DocType

--------------------------

A PDF FILE
A DOC
B PDF
B PDF
B XLS
C PDF
D XLS
D PDF
D XLS
F PDF
F PDF
G PDF
H XLS

Need a way to be able to add an additional column based on the values in the name column and Doctype.

Name | DocType | Status

----------------------------------------------------

A duplicate PDF
A duplicate DOC
B duplicate PDF - PDF multi
B duplicate PDF - PDF multi
B duplicate - Multi PDF XLS
C PDF Unqiue
D XLS duplicate
Duplicate PDF D
D XLS duplicate
Duplicate PDF - PDF multi F
Duplicate PDF - PDF multi F
G single PDF
H single XLS

Logic to use is, check the column name, if there are multiple entries with additional verification of same name DocType, if there are multiple entries for PDF and then mark status as «Double - Multi PDF»
If there are multiple entries for the name column, but only one of these entries is the PDF, then mark the status as duplicate.
If there is only one entry per name, no matter that the Doctype, mark the status of "Single".

Let me know if the problem needs more explanation.
Thank you.

Published by: 934827 on May 16, 2012 14:03

Hello

Here's one way:

WITH  got_cnts     AS
(
     SELECT     name
     ,     doctype
     ,       COUNT ( CASE
                         WHEN  doctype = 'PDF'
                   THEN  1
                   ELSE  NULL     -- Default, but it doesn't hurt to say it
                     END
                )   OVER (PARTITION BY name)     AS pdf_cnt
     ,       COUNT (*) OVER (PARTITION BY name)     AS name_cnt
     FROM     table_x
)
SELECT    name
,       doctype
,       CASE
           WHEN  name_cnt = 1  THEN  'Single' -- or 'Unique'
           WHEN  pdf_cnt  > 1  THEN  'Duplicate - Multi PDF'
           WHEN  pdf_cnt  = 1  THEN  'Duplicate'
       END          AS status
FROM       got_cnts
;

If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.

What do you do if there are multiple lines with the same name, but none of them have doctype = 'PDF '? Depending on your answer, you do not have a subquery.

Tags: Database

Similar Questions

  • How can I make a slideshow with the buttons previous and next to autoplay

    Hello

    I did an automatic reading of the previous slideshow with buttons and next, when I saw the site and press one of the buttons need me back to the front, BUT automatically stops.

    first possible keep the slide show playback even I press any button?

    Thank you

    SebastianScreen Shot 2013-07-29 at 1.15.52 PM.png

    Slideshows of auto playback can only be interrupted when a trigger or the Prev / next icon is clicked. And once paused, the page must be reloaded so that the feature of AutoPlay slideshow for re - initialize. Feel free to add an idea to our ideas section.

    Thank you

    Vinayak

  • ToolTip for the button previous and next in trainButtonBar

    I'm not able to view the ToolTip for the buttons next and previous by using trainButtonBar. Can someone help me on this?

    Published by: 952401 on August 13, 2012 05:50

    Hey Vinay... I think you can try this
    Required fields in a train

    It was exactly the solution you need.

    Thank you
    Serge

  • Slideshow button previous and next does not work, someone has the same problem?

    When I put more than two slide shows on stage, the button previous and next stop work.

    Hi Bernard! Finally, I solved the problem. I put borders (area) in the upper layer than the layers of the slide show. =/

    Now, works great. Thank you very much for the help!

    Home

  • Previous and Next buttons

    Hello

    I made a slideshow and I want to put the buttons "previous" and "next" inside.

    I tried to find some tutorioals but without success.

    Does anyone know where to find a tutorial for that?

    Thank you

    Poul

    Hello

    Here is a slideshow tut:

    http://paultrani.com/2013/07/how-to-create-a-slideshow-in-edge-animate/

  • Is it possible to move 'previous' and 'next' in the library?

    Is it possible to move 'previous' and 'next' in the library?

    For example, I'm editing Symbol_1, then I go to Symbol_22. Now to return to Symbol_1, I need to find it in the library and double-click it. Is there a shortcut for that?

    No, but you can always use the search option of library gradually the number of displayed items. It would be a good feature request that I find myself jumping between the depths specific movieclip on common clips often. A bit like a bookmark clip/depth.

  • Show/hide the paging previous or next link from the remaining pages

    Please, I have a list of webapp. I want to show or hide the previous and next pagination url based on the number of pages on the left and click on the url of paging:

    Please, this is my code:

    < div class = "paging" >

    < div class = "paginationtextblock" > < a href = "{{testimonialWinners.pagination.previousPageUrl}}" > back < /a > < / div >

    < div class = "paginationtextblock" > Page {{testimonialWinners.pagination.currentPage}} < / div >

    < div class = "paginationtextblock" style = "hidden" > < a href = "{{testimonialWinners.pagination.nextPageUrl}}" > Next < /a > < / div >

    < / div >

    < / div >

    Thank you in anticipation

    Hello Stephen, thanks again for the contribution. But after watching your implementation code and what is returned through json. I have cut my own solution, I've found directly found and requires so much affect. See below:

    See it in action here: support in schools Astymin schools program

    I think that the latest update of BC present further options for pagination, which allows us to make more based on the available json tags. Thank you once again for inspiration.

  • Previous and next navigation

    I know this is a common and simple solution, but I don't know how this word in google a tutorial.

    Here's the situation:


    I have a total of 8 photos, which, when clicked, will open a web page describing the peak. There are a total of 4 visible on the stage at any time.  I have a previous and next button.  When I click the button following, I want the images to slide to the left, the 1st image out of the animated scene and moving a 5th in for display.  When I click the back button, I want the pictures to slide to the right, creating the opposite effect.

    I am able to make the pictures to slide when I click on the next button, but I can't seem to drag in the opposite direction.  I only know the gotoAndStop(); who jumps back and does not slip backward.  How can I rewind flash so I can get the reverse animation, rather than jump back?

    I made it clear?  See why can't google?  Ha ha.

    If you're speaking about moving the forwward and backward through an animation of scenario, then maybe this other ads will provide a preview for you: http://forums.adobe.com/thread/510091?tstart=0

    This is may be easier to manage if you use actionscript to control the x position of a movieclip that contains the images instead of using an approach to chronology.  You can use the Tween class to take care to have things actually appear as movement rather than jump.

  • I bought a new Iphone 5 s of Snapdeal in India, but when I created an account in the App store and next step his asking me to specify the details of credit card and the iTunes gift cards and codes I don't have an option to select none that I just

    I bought a new 5s of Iphone of Snapdeal in India, but when I created an account in the App store and next step his asking me to specify the details of credit card and the iTunes gift cards and codes I don't have an option to select none I just an options to select Master card, Visa and Amex. So what should I do to continue without entering a those sections.

    This step must be completed before you can go to the next step in creating an App Store account. It is only for the purpose of verification and just incase accidentally make you an in - app purchase.

    You cannot create an App Store account without card number.

    I hope this helps.

    AppleMan

  • Compare the current time and date with last modified?

    Compare the current time and date with last modified?

    What is the ideal way due to report at the last modified file with the date and time class? last modifed class in the file value is of type long.

    798642 wrote:
    No no no no, currentTimeMillis() only gets you the time... I need to compare the Date and time.

    You should read the docs more closely. It gives you the current time in time, which includes the date.

  • [11] ask for more info about the records, research and the Datagrids

    Hello

    I'm looking for info on the records, research and the Datagrids, I can't find a lot of research on the web.

    Thanks a lot if yo u can help.

    The FNDLOAD program creates scripts ldt is the kind of script you want to say. You issue a command to the program that tells it what kind of Application Oracle configurations you want to transfer to another instance and creates the script ldt that you use the target instance.

    See Support Oracle Note 274667.1 for orders to move configurations because I never used to move the datagrids.

  • Return of the records for the current month, previous and next

    Hello.

    Robert Charlton contributed to my last question on this topic and thank him once more for this.

    When you filter the results of the report by using the following database returns records for the current week:


    WHERE 'SS_LEAVE '. "" LEAVE_TYPE "="SS_LEAVE_TYPE. " "" IDENTITY CARD ".

    AND)
    InStr (superior ("EMPLOYEE"), upper (nvl (: P2001_SEARCH, 'EMPLOYEE'))) > 0 or
    InStr (upper ("SUPERVISOR"), upper (nvl (: P2001_SEARCH, 'SUPERVISOR'))) > 0
    )
    AND TRUNC (end_date) < NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sam') + 1
    AND TRUNC (end_date) > NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, "Sat")-7


    My question is this time is:

    How to make a filter for the current month, the 'previous month', and 'next month '?


    Kind regards

    Steve Welch

    Steve,

    Current month:

    and trunc(end_date) >= trunc(current_timestamp,'MM') and trunc(end_date) < add_months(trunc(current_timestamp,'MM'),1)
    

    Previous month:

    and trunc(end_date) >= add_months(trunc(current_timestamp,'MM'),-1) and trunc(end_date) < trunc(current_timestamp,'MM')
    

    Next month:

    and trunc(end_date) >= add_months(trunc(current_timestamp,'MM'),1) and trunc(end_date) < add_months(trunc(current_timestamp,'MM'),2)
    

    -David

  • The access key to select the previous and next image

    Hi all

    I did a lot of research, but I can't seem to find an answer to this.  I already know which keys scroll to the previous or next < and > frame but they only scroll; they do not pick.  Is it possible to use the keyboard to select the previous or next image while selecting as well?  What I mean by select is that if, for example, I selected the transform tool and I use a keyboard shortcut to scroll to the next section, I must also click on the image with the mouse before I can turn.  Or, if I have the align Open box, I can use a keyboard shortcut to scroll to the next section without the need to click on this image before I can align.

    I hope that I have explained this clearly.  In any case, I would like to know if there is a way to do it.  Thank you.

    Create a jsfl file that contains:

    var tl = fl.getDocumentDOM () .getTimeline ();

    var selectedFramesA = tl.getSelectedFrames ();

    tl.setSelectedFrames (selectedFramesA + 1 [1], selectedFramesA [selectedFramesA.length - 1] + 1, true);

    and save that as selectNextFrames

    //////////////////////////////////////////////////

    create a 2nd jsfl file containing

    var tl = fl.getDocumentDOM () .getTimeline ();

    var selectedFramesA = tl.getSelectedFrames ();

    tl.setSelectedFrames (selectedFramesA [1-1, selectedFramesA [selectedFramesA.length - 1]-1, true]);

    and save that as selectPreviousFrames

    ///////////////////////////////////////////////////////////////

    Add two jsfl files to folder Commands and then create shortcuts for each in the edit keyboard shortcuts Panel.

    on win 10:

    C:\Users\\AppData\Local\Adobe\------\Configuration\Commands

  • Configure the Previous and Next buttons

    Is it possible to configure the buttons back and forward in the play by slide bar? I have seen that you can disable the PlayBar by blade, which would be another option, but I don't have a subscription service or ASA, so I do not have access to these features. I wish I could control what slides these buttons will make you.

    Hello

    It is not possible to configure the next/previous buttons on the PlayBar.

    However, you can disable the playback bar and put some action buttons PowerPoint which, once clicked will be the user to the desired slide.

    Thank you

    ALPI

    Adobe engineering team

  • Previous and next

    Hello

    I have an interface with multiple fields in a single view. The filtering is done via a code. I have a
    an inventory ID = 1133 and the page will have to introduce myself 14 folders. I used the previous and the next control of the data view.

    When I press the next, second, it has the record and when I click again it doesn't show me the third record and others not.

    I put pagedef refresh = still, I put in the iterator and all ChangeEventPolicy components = "ppr" and I took partialSubmit = true property of the button.

    Someone tell me why the operation only once?

    Note: I did a test by dragging the view without searching through code, and the next and the previous work.

    Thank you

    Marcos Santiago

    I don't think you need to use Refresh = always for this use case... It does not work with the default value?

Maybe you are looking for

  • Mini 210: the mini 210

    Hi guys.I have a HP mini 210 which I use mainly for internet when they travel, but also for playing iTunes for house music when I execute concerts. Last week the on the key sound turns power on and off remains permanently lit. If I hit him, the o/s t

  • Impossible to 'System' to defrag Portion of the hard disk on Windows 7 Pro or Windows 8 Pro dvt7-3000

    I have a laptop HP Pavilion dvt7-3000 CTO that has a single disk drive hard 500 GB.  The operating system has been improved in Windows7 Pro (64-bit) to Windows 8 Pro (64-bit), but the problem occurs in both operating systems.  When conducting the def

  • Beats not selectable 1 and Quick Play on Apple Watch

    Hello I have Apple Watch sport with watch Os 2.1. I want to play my watch 1 bat instead of having to press listen on my phone all the time to activate it.  In my view, there is an option in the menu music on the watch, but it is not selectable.  Quic

  • HP 1040 G1 Folio: HP 1040 G1 gobi WWAN and Windows 10 lt4112 Folio

    Dear Forum, I just upgraded my G1 Folio 1040 to 10 Windows and now the module WWAN (gobi lt4112) no longer works. I installed the latest drivers, but the system does not see and in Device Manager, it appears in the device generic form broadband with

  • How to add a Mac to an existing network of Wrt160N

    I have a work network, set in place using a XP computer. I added the devices successfully wireless in the past. I am trying to add a Mac, but it asks a passwork. There is no password that I know in the wireless setup and didn't have to do it on an XP