Query trouble - EXISTS doesnt work like I thought

EXISTS is not behaving like I had hoped.
Help would be much appreciated
SELECT count(*) from OPPS
WHERE OPP_CODE = "A"
AND
EXISTS (
SELECT * FROM OPP_SUB_TABLE S, OPPS O
WHERE S.ID = O.ID AND
S.DTYPE = "1" AND S.DSUBTYPE = "2"
There are 14000 rows in OPPS where OPP_CODE="A"
There are only 31 rows in OPP_SUB_TABLE that have
both DTYPE = "1" and DSUBTYPE = "2"
I thought exists would work like an IN sort of, bringing me only 31 results.
Instead I get all 14000, what I am missing here?

EXISTS is like a boolean operation. It will return the row in your outer query if at least one row exists in your subquery.
Because you haven't coordinated the subquery with your outer query, every row will be returned (apparently because your inner query always returns a row).
I'm guessing you meant something like this:
SELECT count(*)
FROM   OPPS O
WHERE  O.OPP_CODE = 'A'
AND    EXISTS (SELECT 1
               FROM   OPP_SUB_TABLE S
               WHERE  S.ID = O.ID
               AND    S.DTYPE = '1'
               AND    S.DSUBTYPE = '2'
;(fixed the double quotes per Warren's example)
Message was edited by:
Eric H

Similar Messages

  • Slideshow Music problem!!!! It doesnt work like it says it on the box.

    I have put together some slideshows and i find every time there is a problem with the fit to music option when i select a track from my itunes library. If i let it run fine it works but if i press fit music to slide show then the track goes into a total slow down and even if i reselect another track it still repeats the same problem. ive tried with 20 slides to 40 slides. So at this point I am certain that this part of the program does not work properly. i see this problem all over the internet so adobe fix it please. Its a simple option so it doesnt take rocket science to press 2 buttons.. but these buttons dont work.  Selling something that doesnt work sends me rushing back to aperture. Anybody else got this problem..u bet. fire the guy who is wasting my time having to write this.

    fourwalls4 wrote:
    So, are you going to share the solution because I have run out of vriables to play with.
    There are a couple of ways to get around this limitation.  The "right" way is a pain.  The "easy" way is potentially problematic.
    Bottom line:  The transitions and slide duration boxes only allow precision down to a tenth of a second.  If your song length and slide count don't divide up to an integer of tenths of a second, you can't fix this in the UI.  If they do, it's possible the tool won't choose these properly due to roundoff error.
    My suggestion is to select songs/slide counts so they do divide up into an integer number of tenths of a second (that's the problematic part) and then manually pick a slide+fade time to match that.  If you can't do that, you might need to add a tenth to one or the other from what the tool chooses, but then your show might finish just before the song does.
    The "right" way is to manually edit the template, where unlimited precision (well, I suspect it's 32 bit floats or something) is allowed.  That's a pain.
    Lightroom shouldn't force either solution onto you, but the 0.1s precision is currently the limitation here (not the math education of the team, a few of whom hold advanced degrees in mathematics and related fields).  Hopefully, the team will fix that problem.

  • Share - Burn option in IPhoto - not working like I thought it would

    Hi
    I have selected 67 photos in iphoto - totalling 206MB in size. I want to burn these to a CD Rom to give to a friend to use as jpegs
    I select Share - Burn and insert a blank CD ROM
    I get the error message "There is not enough space on the disc to burn all the photos you selected."
    But the disk can take 700MB????
    Then I try by exporting the same photos to a folder on my mac, and then burning these to the CDROM outside of iPhoto - and that works fine
    So why does the SHARE - BURN option not work in iPhoto in this way?
    Many thanks

    The Share -> Burn option creates a "mini" iPhoto Library on the disk, including all the versions, thumbnails, databases and so on. It's designed for sharing with another iPhoto user.
    If you just want to share the photos the File -> Export option is the way to go.
    Regards
    TD

  • HT1430 my ipod doesnt work like if i turn it on it shows me to connect to itunes i do it but it doesnt do anything what i can do ????

    it shows me like when i first bought it andni can restartet it i dont know what to do pls help

    The screen is telling you to connect the iPod to your computer and restore via iTunes. For how to restore see:
    iTunes: Backing up, updating, and restoring iOS software

  • I turned on the passcode lock to come on in 1 hour.  It doesn't seem to be working.  I thought that this would make the Ipad 2 IOS 7 require me to type in a code after 1 hour.  Is my thinking not right on this?

    As stated I turned on my passcode lock to come on after 1 hour of operation.  It doesn't work like I thought it would.  My thoughts were that it would go to the lock screen and then require a code.  Is my thinking not right on this?  What am i doing wrong?

    The passcode will be requested after the device has been in sleep mode for one hour.  It does not turn off the device, nor is it a usage timer.

  • I am having alot of trouble i want to use imessage but everytime i turn it on it turns on but doesnt work and it says verifying but its verifying my old number and i need it to verify my new number but it wont let me

    i am having alot of trouble i want to use imessage but everytime i turn it on it turns on but doesnt work and it says verifying but its verifying my old number and i need it to verify my new number but it wont let me

    You can likely download the last compatible version by:
    Starting when iOS 7 was released, Apple now allows downloading the last compatible version of some apps (iOS 4.2.1 and later only)
    App Store: Downloading Older Versions of Apps on iOS - Apple Club
    App Store: Install the latest compatible version of an app
    You first have to download the non-compatible version on your computer. Then when you try to purchase the version on your iPod you will be offered a compatible version if one exists.

  • Please help i can't share my project I did try in all of them and it doesnt work it apears like that........ The share operation Master File has failed The operation could not be completed because an error occurred when creating frame 608 (error -1). and

    I did try in all of them and it doesnt work it apears like that........
    The share operation Master File has failed
    The operation could not be completed because an error occurred when creating frame 608 (error -1).
    and i dont know what to do plese hlp me....
    Re: when i try to share my project to quicktime aroun 50% appears error -1 and i can't share it what to do please help 

    Double post…

  • HT1459 slide bar doesnt work its like screen is locked

    slide bar doesnt work its like screen is locked its old a second generation

    I suspect a problem with the wall charger.  Have you tried another wall charger and/or cable?  I would make an appointment at the Genius Bar of an Apple store.  If you bought the charger from Apple they will replace it if it is within warranty.

  • I want to use the SQL query IF EXIST to update or insert data in a ms access table, but it doesn´t work

    Hi,
    I want to use the SQL query IF EXIST to update or insert data in a ms access table, but it doesn´t work
    (fault number -2147217900)
    I want to search for a value in a ms access table , if it exist i want to update it, if not i want to insert a new row.
    Working with LabView 7.1, database con. toolset.
    Who can HELP?
    Thanks a lot
    Marco

    Hello,
    I think that If exist is not a standar SQL command (I know it exists I think in Oracle and SQL server), MS access doesn't support it, so I think the best way to do it is first make a Select and then either an Update or an insert, sorry...
    Paulo

  • Query Views on Workbook - filter doesnt work

    Hi All,
    I have developed a workbook using a query view, When i try to do filtering using the filter button the workbook data does'nt change. Can anyone of you advise what needs to be done.
    Thanking you.

    HI Rohith,
    Thanks for the quick response.
    I tried out what you have mentioned, it didnt work. query view is inserted into a data grid and created the workbook. Filter funtionality is available and its currently working during variable value entry. Once the report is generated filter doesnt work.
    any suggestions?
    Thanks.

  • Safari says "i cannot open the page because the server cannot be found" I get this on Safari and Mail does not function. Apps work like a dream. All Windows OS are screaming. Any thoughts?

    Safari says "i cannot open the page because the server cannot be found" I get this on Safari and Mail does not function. Apps work like a dream. All Windows OS are screaming. Any thoughts?

    You can check this thread for the answer you are looking for.
    https://discussions.apple.com/thread/3685247?start=0&tstart=0

  • Guys how to fix the audio problems of my itouch? The volume bar dosnt exist and the loudspeaker doesnt work. . .Sounds only works in headset  please help thanks!!!!

    Guys how to fix the audio problems of my itouch? The volume bar dosnt exist and the loudspeaker doesnt work. . .Sounds only works in headset  please help thanks!!!!

    Post this in the iPod Touch forum.
    https://discussions.apple.com/community/ipod/ipod_touch
    B-rock

  • How to deal with query that works like dir or ls

    I just can't figure it out how to deal with query that works like dir (Win32) or ls(unix) with special character like '*' and '?' , ex. c:\> dir j*.t?t
    Could somebody please tell me?

    Here's some code for using a FileFilter for the listFiles() method of the File class:
    import java.io.*;
        FileFilter myFileFilter = new MyFileFilter("*.t?t");
        File[] files = File.listFiles(myFileFilter);
      class MyFileFilter implements FileFilter {
            private String pattern;
            public MyFileFilter(String pattern) {
                this.pattern = pattern;
            public boolean accept(File file) {
                if (file.isDirectory()) {
                    return false;
                if (file.getName() ??matches?? pattern) {
                    // you'll have to put the pattern match code here!!
                    return true;
                return false;
      }maybe someone else can help with the pattern matching!

  • HT204409 i have a ipodtouch 4th generation and when i go to my settings and go to my wifi and i turn it on and it doesnt search up anything i tried alot of things to fix it like reset it . But it doesnt work .  What can i do ?

    i have a ipod touch 4th generation and when i go to my settings and go to my wifi and turn it on and it doesnt search up anything i tried alot of things to fix it like reset it, but it doesnt work . what can i do ?

    Is this the problem?
    iOS: Wi-Fi or Bluetooth settings grayed out or dim
    Otherwise
    Does the iPod connect to other networks?
    Try:
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on the router
    - Reset network settings: Settings>GeneralReset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup
    - Restore to factory settings/new iPod.
    - Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • Trouble shooting doesnt find my i pod and it wont automatically download song s like it used to

    Trouble shooting doesnt find my ipod and it wont automatically download songs I purchased

    Hi RNRSCO,
    Thanks for visiting Apple Support Communities.
    If your iPod is not recognized by your computer, be sure to go through all of these troubleshooting steps:
    iPod not recognized in My Computer and in iTunes for Windows
    http://support.apple.com/kb/ts1369
    Best Regards,
    Jeremy

Maybe you are looking for

  • Icons in menu bar and standard menus are invisible!

    I'm having an issue with OS X 10.8.2 on my 15" (not Retina) Macbook Pro (late 2011, Core i7 2.4 GHz w/ 16GB RAM and SSD); The majority of system icons in the menu bar "extras" area (that is, to the right near the date/time in the menu bar) are blank.

  • Final cut pro gamma correction

    Hello. I bet people have posted this before but after searching I could not find a concrete answer. I have FCP 6 and Color 1.5. My display gamma is at 2.2. I edit my cut in FCP and send it to color. No problems there. I color correct in color and it

  • I cant download itunes version 10.5. plain and simple.

    i open it on my computer and it asks me if i would like to download it i say yes and then nothing happens. nothing pops up telling me about an error. nothing. ive checked my computer and cant find anything and cant figure out whats wrong. im far from

  • SELECT POOLED TABLE IN SUBQUERY

    Hi all, how to select pooled table in subquery? e.g. Pooled table: A017 SELECT * FROM A017 INTO CORRESPONDING FIELDS OF TABLE itab WHERE exists ( SELECT * FROM EINA WHERE MATNR = A017~MATNR ). it gives a syntax error and runtime error when I use A017

  • Mail not showing attachments icon after 10.5.3

    Another trouble for Mail and attachements : in the list pane, although I have set the column to see if there are attached files (paperclip icon), since 10.5.3, these attachments don't show up in every case. Quite strange, a message with 5 attached pi