SQL to locate certain documents

Oracle 11R2

Data cleansing. We want to find records in the EQUIPIMENT_BILLS where the STATUS is 'INFO', 'DISABLED', 'NONE '.
The overflow if another answer (s) exists with the same BILL_NUMBER, its STATUS is also 'INFO', 'DISABLED', 'NONE '.


BILL_NUMBER is not unique in the EQUIPIMENT_BILLS table. However most of the time there is only a single record.

With the help of the following query to find the records we can cleanup.

SELECT 
   EB.BILL_NUMBER
 FROM
   EQUIPIMENT_BILLS EB 
 LEFT JOIN  
   EQUIPIMENT E
 ON
   EB.EQUIPIMENT = E.EQUIPIMENT
 GROUP BY 
   EB.BILL_NUMBER 
HAVING SUM(CASE WHEN NVL(E.STATUS, 'NONE') IN ('INFO', 'INVALID', 'NONE')  THEN 0 ELSE 1 END) = 0;
My question is is there a better way to do it?

Hello

Here's another way:

SELECT  bill_number
FROM     equipment_bills
WHERE     equipment  NOT IN (
                    SELECT     equipment
                    FROM     equipment
                    WHERE     status     NOT IN ( 'INFO'
                                     , 'INVALID'
                                     , 'NONE'
                                     )
                 )
;

Depending on what mean you by "better", it could be better.
I think it's a little easier to uderstand, but I'm not one who has to maintain the code.
Try it on your system to see if there is a significant difference in performance.

Tags: Database

Similar Questions

  • Research problem, won't find certain documents (in files)

    Ive just had to wipe my macbookpro & have updated to El Capitan, however there is now files that I can't get. This worked well before. It seems that it is a limited number of "files" (with a large amount of documents in their midst) which cannot be searched (IE does not give a result) even if they are all there and can be found manually (if I had a lot of time)

    It seems to pick up documents 'old' and 'new '.

    They are located in the documents folder and I checked it is not 'disabled' in the spotlight thus preferences not limited in the privacy of the spotlight section. Can anyone help?

    Thank you. Darren

    Try to re-indexing of the drive

    Featured: how re-indexing of folders or volumes - Apple Support

  • Strange problem with the default location of Documents

    I have recently reinstalled Windows after a hard disk failure. Fortunately, I had previously moved the library of 'My Documents' to a secondary drive, so I don't lose anything. Merge all records (i.e. move the new default library to merge with the library on my secondary drive) seemed to cause some problems with some file search programs, then my new primary drive being much bigger than my old one that I decided just to move the library of My Documents from my drive C (the OS partition).

    Here's the weird part: under start > Documents (right click) > properties, I have the save location set to C:\Users\MyName, which (I think) is normally by default when you install Windows. But if I click on "restore defaults", it switches to the root of one of my secondary drives (drive E).

    This is problematic because some of my games can't seem to find my old safe. Backups are in Documents > my games, but instead to find there as it should the games create a new folder 'My games' in the root directory of drive E, although I still have My Documents to save the location defined in its usual location on my primary C drive.

    So I think the problems are linked, and I can't understand why by clicking on "restore default settings" on the start menu > properties of Documents it would lead to the use of the root of my E drive as the location for all the files and folders "My Documents".

    I carefully edit the registry to make sure that this value is set correctly. Be sure to include the name of the final folder ('Documents') in the path. If you simply specify your user folder, all your documents will be dump it instead of inside the real documents folder.

  • Location of documents in the Simulator

    I created a folder in the folder of Documents with the AIR. Where is it located on the Simulator?

    Thank you

    Bobby Rafferty

    @bobbyworld

    Take a look at this thread:

    http://supportforums.BlackBerry.com/T5/Tablet-OS-SDK-for-Adobe-AIR/application-sandbox-file-system-l...

  • How to delete recent locations of Documents

    Example - when opening Excel recent documents - I could to the side workbook see no docs.  However, I am unable to clear recent locations in addition to without deleting them manually one at a time.

    I would like only to documents do no show at all.

    Thank you

    Click the Start button and click on your username.

    Open the Favorites folder and remove the link to Favorites any you don't want.

  • Filtering of certain documents

    I want to filter certain folders. I have a field called flag that has values equal to 1 or 0. I want only the records that have the flag = 1. Is it possible to filter out using filter option in the window to display the results?

    Barro

    Hello

    The question is: at what point you want to filter the records?

    If, in a process, use check the value, enter the attribute and check its value. While the control down the filter output to 'Pass' and can be used in the rest of the process. [If you have several values that you want to check, use check the list rather than checking the value.]

    If at the time of the snapshot, you can use a WHERE clause on the snapshot. You can set filters simple like this in the user interface if you do not want to write the SQL code.

    Case the runtime (the set of data to be performed during the execution of a work), use an outsourced on the snapshot (if you want to vary the filter on different series with a command line argument or a run profile), or just set "reader" (if you want to always select the same data for the work of filtering in the execution of the job preferences but want all of the data normally instant for other jobs).

    Kind regards

    Mike

  • Pages pull up of certain documents and States "it cannot be opened for some reason any."

    I use the Pages more up-to-date on my macbook, but whenever I have pull up some documents, he says that he cannot find it for some reason any? I had no problem before, but all of a sudden does not work?

    If you get a dialog box that says essentially that "Pages cannot open this document for some reason any", you're actually done with this document because he suffered internal damage. Get an old copy of your Time Machine backup.

  • How to open certain documents in Vista, example. ODT and. XPS

    Ping: Bruce Hagen
    Documents not opening since update to the new Member States. I use Windows Media and he said: it does not recognize, nor can it convert to see.
    The. ODT & the. XPS. It gives me 'open with the option' I tried Picasa also IE and same thing. I don't know what file associations to use
    & and/or reset. This is the second time this week MS update screwed things for me. Hope that will / can help me again.
    Thnx a lot, Jaemy

    * original title - Ping: Bruce Hagen Documents will not open *.

    Hi flowerbrackob,

    Please see the thread with a similar fix in question and use:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-networking/cant-open-an-ODT-file/8c015457-FC29-481b-BDDE-17ee22a374ea

    I hope this helps!

  • Player asked to record certain documents

    Sometimes (I think that the older pdf documents) Player 11 wonder to save the document, even if I did not any changes.

    How can I stop this?

    If they are forms, they can ask to register each time by the registration of the protocols by the author of the form. If they are NOT forms, save them under a different name (add a dash between words) and should not ask a record again.

  • [JS CS3] Cannot add a shade to certain documents

    Hello

    I have the following script:

    var myDoc = app.activeDocument;
    colorIt(myDoc, "lime",cmykRatios =[40,0,80,0]);
    
    function colorIt(docRef,colorName,cmykRatios){
        docRef.colors.add({colorValue:cmykRatios, colorModel:ColorModel.process, colorSpace:ColorSpace.cmyk,name:colorName}); 
        }//end colorIt
    

    For some documents this script works as it should. But for others, I get the error message in ESTK "wrong number of color values has been given."

    The error message tells me that I can not add CMYK color chart. If I change the ColorSpace.rgb color space and have only three values in the cmykRatios table, and then the script work in the document which before would not accept it.

    But you try to add a shade RGB to documents previously accepted the new CMYK swatch gives me the same error message: "an incorrect number of color values has been given."

    Obviously, there is a difference between these documents, but I don't see one. Why a User.ID file would accept the CMYK colors but not RGB and vice versa? Clues as to what could be wrong here?

    Thank you

    Tom

    You confused me for a while, that is, until I thought to check your settings!

    There is no property 'space' color in color, it is called 'the space '. Definition of unknown properties is not a mistake (they are added to the object, I think), so the default color space went never what it was during the addition of the new color.

  • where are located the document scripts?

    Hello

    I am new to the designer, where can I find document level scripts?

    Thank you

    Stan

    Document level scripts are part of Acrobat doesn't do not part of the design of the form. There are level and document level page events that exist. Click on the item Page or root in the hierarchy view and in the drop-down list script editor events will show you the subset of events that are available. If there is code on these events they will be marked with a *.

    Paul

  • blocking of certain documents on the internet

    How can I block access to watch some singers on youtube to protect my kids to watch? I want to block all the sites such as youtube that have any material of Lady Gaga and Keisha - two singers.

    Thank you.

    Cannot do.

  • decipherments of certain documents and photos

    A bad example, I know that:

    zllo5,,,MK=-0/59-p[=h.../ [.. jki yk % * [;...]

    These analogs and absurd (to me) number games, numbers, signs, etc.

    How to turn these symbols back into an image?

    There is usually a choice of language as well as this list.

    This happens when someone changes the extension of a file (for example '.doc' in '.txt') while Windows is no longer "knows" what application to use to open the file. You must restore the original extension.

  • "Unable to locate the document capture recognition service. Your installation is perhaps corrupt '-Adobe Acrobat 2015 (2015.008.20082) someone had the same number on this version in a .pdf conversion/export to MS Word 2010?

    Hi all

    I saw this same error appear around the web, but none that relate to Adobe Acrobat Pro DC (2015) and MS Word 2010. Has anyone encountered this same flaw/message when you try to convert/export a pdf file to MS Word 2010?

    After clicking OK several times (through the above message), the export moves in any case, is there a way to maybe get rid of the messages coming, just to make the conversion to operate?

    As an accompaniment, this isn't a problem with the help of MS Word 2013 with Adobe Acrobat Pro DC (2015), but I would like to know if anyone has found a fix work for this export/conversion to Word 2010 (I may be among the masses here with this, but just in case where anyone knows of a fix for this).

    Thank you for your time and any advice greatly received.

    -Pete

    Hi Psymon,

    There will be no change in the application, updates are just to fix some reported bugs. This will improve the user experience.

    Kind regards
    Nicos

  • Cannot locate the document in ADF Faces base tag

    I found a good tag to ADF Faces (10g) basis, using this URL, http://www.oracle.com/technology/products/jdev/htdocs/partners/a
    ddins/exchange/jsf/doc/tagdoc/core/imageIndex.html. This reference contains images for each component of the tag. but somehow the URL no longer works. Someone can tell me why this URL does not work and how/where can I download the same refrence on local computer? That's 10g.

    Thank you

    Jade

    I you download jdev 10 you can find the tagdoc to:

    jdevstudiobase10135\jdev\doc\ohj\adffacesguide.jar

    Unzip the and you'll have several files, one of them is "tagdoc".
    Inside, you have a folder 'base' and 'html '. In the two index.html has the information you want.

Maybe you are looking for