Can I use NOT IN for 2 conditions

My first SQL Query was written as so,
INSERT [rscalc].[Processing_Log] (Source_nm, Log_Type,[Message],Log_dt)
SELECT '[rscalc].[usp_Validate_Generation_Map]', @Log_Type_Id, 'Source Not Found =>' + tp.Source, GETUTCDATE()
FROM [etag].[Tag_Processed] tp
WHERE tp.Source NOT IN 
(SELECT bamap.Name FROM [rscalc].[BA_Area_Source_Sink_Map] bamap
INNER JOIN [rscalc].[VER_Generation_Map] ON Area_Source_Sink_Id = bamap.Id
INNER JOIN [etag].[Endpoint_Type_Map] emap ON emap.Id = bamap.Endpoint_Type_Id
WHERE emap.Endpoint_Type = 'Source' or emap.Endpoint_Type = 'Source/Sink')
I now need to include 2 conditions,
tp.Source NOT IN and tp.Source_CA NOT IN, I came up with something along the lines of below, but I don't think this is correct?
INSERT [rscalc].[Processing_Log] (Source_nm, Log_Type,[Message],Log_dt)
SELECT '[rscalc].[usp_Validate_Generation_Map]', @Log_Type_Id, 'Source:' + tp.Source + ',Source_CA:' +                              
                        tp.Source_CA + '=>Not Found', GETUTCDATE()
FROM [etag].[Tag_Processed] tp, [rscalc].[BA_Area_Source_Sink_Map] bamap
INNER JOIN [rscalc].[BA_Areas] bareas ON bamap.BA_Area_Id = bareas.Id
INNER JOIN [rscalc].[VER_Generation_Map] ON Area_Source_Sink_Id = bamap.Id
INNER JOIN [etag].[Endpoint_Type_Map] emap ON emap.Id = bamap.Endpoint_Type_Id
WHERE  
emap.Endpoint_Type = 'Source' or 
emap.Endpoint_Type = 'Source/Sink' AND
tp.Source <> bamap.Name AND
tp.Source_CA <> bareas.ETAG_source_nm
Greg Hanson

>> I now need to include 2 conditions,
tp.Source NOT IN and tp.Source_CA NOT IN, I came up with something along the lines of below, but I don't think this is correct?
Sometimes the best option is to try it :-)
In this case the syntax is correct but we have no way to check in practice, unless you post the DDL+DML (queries to create the relevant tables and insert some sample data). In any case those not the same queries. You changed the logic of the query
and not just add 2 conditions. Most likely the execution plan will show you differance solution.
Can you please post DDL+DML?
  Ronen Ariely
 [Personal Site]    [Blog]    [Facebook]

Similar Messages

  • HT204053 Dear Support Team, every time i tried to logon Icloud its gives me wrong user name or password and at the end it show me error " This Apple ID is valid but is not an ICloud Account" then how can i use one account for same Apple ID and ICloud???

    Dear Support Team,
    Every time i tried to logon Icloud its gives me wrong user name or password and at the end it show me error " This Apple ID is valid but is not an ICloud Account" then how can i use one account for same Apple ID and ICloud?
    Thanks

    It is not possible to create a new iCloud account using a Windows machine. You must create the account using a Mac (10.7.5 or more) or an IOS device (iPhone etc). Once that is done you can sign into and use the account on your Windows machine.

  • Can I use an iPad for taking hand written notes using a stylus? Not a large stylus, but a one like Sumsungs.

    Can I use an iPad for taking hand written notes using a stylus? Not a large stylus, but a one like Sumsungs.

    Hi HawkeyeD1977, thank you for watching!
    1) I don't think you can really scratch the screen with the Jot Script. I don't have a screen protector, but I have reasons to think it will still work if you have one (I tried the Scrip through a think sheet of plastic, and I still works: more on that in my next video).
    2) It's true that the Script is noisy, but as I often say: have you ever tried to focus on the background noise of, say, a classroom? It is very noisy too! I'm always surprised by how good our brain is to filter background noises. So really, it depends on your environment and on the ability of your brain to filter noise. For me, I'd rather use a stylus that is a little noisy but very precise. It also depends on how you write text: as you can see on my video, I don't lift my pen very often, I write big groups of letters together.
    3) You should watch my latest video about that: I talk about Memo and Notes Plus. Memo has a handwriting technology that you can test for free, and buy as an in-app purchase inside Notes Plus, to use in a realy note-taking app. In Notes Plus, you can indeed convert just selected areas containing text.
    4) It won't have a text convertor, not in the next update. Maybe latter!
    If you want more information about the Jot Script, stay tuned: by the end of the week, I will have uploaded a video to talk about the Scrip with more hindsight after one month.

  • I download ios8 I can't use my song for ringtone and other ringtone it is not loud and I miss call

    I Download ISO 8 and I can't use the song for my ringtone , but it vibrate and I can't hear the phone rings . Other ringtone it is not loUd

    There is a difference between the passcode and the sync key.<br />
    The passcode allows to setup all sync parameters with a single code on other devices.<br />
    To enter the sync key (and user name and password) you need to click on "I don't have the device with me" at the bottom of the "Add a Device" window (Click Connect).
    * https://support.mozilla.com/kb/where-can-i-find-my-firefox-sync-key
    * https://support.mozilla.com/kb/find-code-to-add-device-to-firefox-sync

  • My daughter is not old enough to have her own Apple ID but has an iPhone. Can I use my ID for my iPhone as well as her iPhone?

    My daughter is not old enough to have her own Apple ID but has an iPhone. Can I use my ID for my iPhone as well as her iPhone?

    Yes

  • HT3354 how can i use one table for reference to another

    how can i use a table for a referance to another eg when i type a word in a cell, i will like it to match the word with another table then return the information in the cell i am using

    you can use vlookup() (or any of the lookup family of functions) to locate an item based on a key value:
    Here is an example of something you can do with two tables:
    The table on the right is title "Data" and stores a list of names with age and favorite color.
    The table on the left uses the value in the first column to lookup up information in the table Data
    in the table on the left:
    B2=IFERROR(A2&" is " & VLOOKUP(A2, Data :: A:D, 2, 0)&" years old and likes the color "& VLOOKUP(A2, Data :: A:D, 3, 0), "NOT FOUND")
    I know this look complicated.  so I'll break it up into smalled pieces:
    first the "&" is called the concatenate operator and joins two strings.  like this:
    a string is a set of characters between double quotes.
    so "string 1" & "string 2" becomes "string 1string2"  or "Sam " & "Jones" becomes "Sam Jones"
    you can use cell references instead of strings directly in which case the concatenation is performed on the contents of the cells.
    so if cell A1 contains "Hi " and the cell A2 contains "There"  then A1 & A2 will result in "Hi There"
    so you could add the formula
    A3=A1 & A2
    this is short hand for select cell A3 then type everything including the A3 so that A3 contains "=A1 & A2" (omit the double quote)
    OK.  So the formula I provided concatenates several items together:
    it concatenates A2, then the string " is " then a formula, then the string " years old and likes the color " then a formula
    the two formulas (highlighted in blue) perform a lookup of the value in cell A2 in columns A thru D of the table named "Data".  If if finds the value in cell A2 in the first column of the lookup range in the table Data (column A) then it returns the value from the same row but in the second or third column.
    all that is in a function calld iserror() to trap the condition where the calue you enter in A2 does not exist in the table Data:
    You will find the Numbers users guide and function reference helpful.  You can download then from Apple here:
    http://support.apple.com/manuals/#productivitysoftware

  • Is there any way to an index that can be used to include the "OR condition "?

    Hello I have some questions.
    The test was conducted in the following procedure .
    create table test
    c1 varchar2(10),
    c2 varchar2(10),
    primary key(c1)
    create index test_idx1 on test(c2);
    Command> explain select * from test where c1 = 'AAAAAAAAAA' or c2 = 'AAAAAAAAAA';
    Query Optimizer Plan:
      STEP:                1
      LEVEL:               1
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST
      INDEXED CONDITION:   <NULL>
      NOT INDEXED:         TEST.C2 = 'AAAAAAAAAA' OR TEST.C1 = 'AAAAAAAAAA'
    Command>
    Command> explain select * from test where c1 = 'AAAAAAAAAA' and c2 = 'AAAAAAAAAA'
    Query Optimizer Plan:
      STEP:                1
      LEVEL:               1
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST
      INDEXED CONDITION:   TEST.C1 = 'AAAAAAAAAA'
      NOT INDEXED:         TEST.C2 = 'AAAAAAAAAA'
    Command>
    By including the "OR condition " in this test does not use the index.
    Is there any way to an index that can be used to include the "OR condition "?
    Thanks.
    GooGyum.

    A database cannot in general use indexes in this way for an 'or' involving two different columns. However, for this specific example one can easily rewrite the query using 'UNION' to use the relevant indexes while still giving the same (correct) result:
    Command> explain select * from test t1 where t1.c1 = 'AAAAAAAAAA' union select * from test t2 where t2.c2 = 'AAAAAAAAAA';
    Query Optimizer Plan:
      STEP:                1
      LEVEL:               1
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST
      INDEXED CONDITION:   T1.C1 = 'AAAAAAAAAA'
      NOT INDEXED:         <NULL>
      STEP:                2
      LEVEL:               2
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST_IDX2
      INDEXED CONDITION:   T2.C2 = 'AAAAAAAAAA'
      NOT INDEXED:         <NULL>
      STEP:                3
      LEVEL:               1
      OPERATION:           OrderBy
      TBLNAME:             <NULL>
      IXNAME:              <NULL>
      INDEXED CONDITION:   <NULL>
      NOT INDEXED:         <NULL>
      STEP:                4
      LEVEL:               2
      OPERATION:           UnionMergeSort
      TBLNAME:             <NULL>
      IXNAME:              <NULL>
      INDEXED CONDITION:   <NULL>
      NOT INDEXED:         <NULL>
    Maybe you can apply a similar trick? If you know there is no possibility of duplicate rows then you can further optimise this (in terms of performance) by using UNION ALL.
    Chris

  • HT201371 Can I use touch id for iTunes Store purchases without having a phone passcode turned on?

    I really don't want a passcode but I love not having to enter my complex password on the small keyboard.  Why does this option have to be linked to a passcode?  Doesn't make a lot of sense.

    From the article:
    You can set up Touch ID in iOS Setup Assistant or by tapping Settings > Touch ID & Passcode. To set up Touch ID, you must first set a passcode. Touch ID is designed to minimize the input of your passcode, but you need a passcode for additional security validation, such as enrolling new fingerprints.
    So yes, that's how it's designed. You must have a passcode, though as long as you understand the caveats:
    In addition, you will need to enter your passcode to unlock your iPhone in these conditions:
    After restarting your iPhone 5s
    When more than 48 hours have elapsed from the last time you unlocked your iPhone 5s
    To enter the Touch ID & Passcode setting
    and
    You can't use Touch ID for purchases if Require Password in Settings > General > Restrictions is set to Immediately.
    you should be able to use Touch ID without needing your passcode. If none of those circumstances is true and you're still being asked for your passcode to make a purchase from the iTunes Store, it would seem that something is amiss with your iPhone.
    Regards,

  • Can i use create function for MSSql scalar and table valude function.

    Hi,
    1) Can i use create function for MSSql scalar and table valued function?
    2) How many type of user defined function are there in oracle 11g express?
    3) And can i reture any "type" form user defined function?
    yourse sincerely

    944768 wrote:
    Q1)That means even if i return predefined types like integer, varchar2 then also PGA is used ?The data type does not determine where the variable is stored. A string (called a varchar2 in Oracle) can be stored in stack space, heap space, on disk, in a memory mapped file, in a shared memory, in an atom table, etc.
    It is the who and what is defining and using that string, that determines where and how it is stored.
    The Oracle sever supports 2 languages in PL/SQL. The PL (Programming Logic) language is a procedural/declarative language. It is NOT SQL. SQL is integrated with it. The PL/SQL engine uses private process memory (PGA). So PL/SQL variables exist in the PGA (but there are exceptions such as LOBs).
    Q2) So please suggest me solution in oracle.Sounds to me you are looking at how to implement a T-SQL style function as an Oracle function, and once implemented, do joins on the function.
    Do not use PL/SQL in SQL in place of a SQL select. It is not T-SQL.
    One cannot use PL/SQL to create functions along the style of T-SQL, where the function executes a SQL using some conditional logic, and then return as if the function was a native SQL select.
    T-SQL is an extension to the SQL language - making it a hybrid and very impure language implementation. PL is based on ADA - part of the Pascal family of languages. The E-SQL (embedded SQL) approach used in languages like C/C++, Cobol and Ada, has been transparently done in PL/SQL. You can write and mix PL code and variables with SQL code. And the PL/SQL engine figures out how to make the call from the PL/SQL engine to the SQL engine.
    But PL/SQL is not "part" of the SQL language and does not "extend" the SQL language in a T-SQL fashion.
    So you need to check your SQL-Server preconcepts in at the door, as they are not only irrelevant in Oracle, they are WRONG in Oracle.
    The correct way in Oracle, in a nutshell - Use the SQL language to do data processing. Use PL/SQL to manage conditional process flow and the handling of errors.

  • Can I use one account for both my labtop and my ho...

    can I use one account for both my labtop and my home computer?
    Solved!
    Go to Solution.

    Softthunder wrote:
    can I use one account for both my labtop and my home computer?
    Hello,
    Yes you can. You can access your account using any Skype enabled computer/device in any country worldwide.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • Can I use touch ID for App Store without using a passcode?

    It seems that the ony way I can use the touch ID for App Store and iTunes is if I have a passcode to get into my phone. I don't want a passcode, it get in and out of my phone too often to have to unlock it all the time and I hate manually typing in my password for App I buy. Why can't it do both, isn't the touch ID just as secure for purchases even if you don't have to unlock the phone to get to it??

    From the article:
    You can set up Touch ID in iOS Setup Assistant or by tapping Settings > Touch ID & Passcode. To set up Touch ID, you must first set a passcode. Touch ID is designed to minimize the input of your passcode, but you need a passcode for additional security validation, such as enrolling new fingerprints.
    So yes, that's how it's designed. You must have a passcode, though as long as you understand the caveats:
    In addition, you will need to enter your passcode to unlock your iPhone in these conditions:
    After restarting your iPhone 5s
    When more than 48 hours have elapsed from the last time you unlocked your iPhone 5s
    To enter the Touch ID & Passcode setting
    and
    You can't use Touch ID for purchases if Require Password in Settings > General > Restrictions is set to Immediately.
    you should be able to use Touch ID without needing your passcode. If none of those circumstances is true and you're still being asked for your passcode to make a purchase from the iTunes Store, it would seem that something is amiss with your iPhone.
    Regards,

  • In Bte can i use same Product for 2 different process

    in Bte can i use same Product for 2 different process

    hi
    as per i know yes but since there r two type of interface behaviour is defferent .
    For
    Publish & Subscribe interfaces 
    if any event occur in this type both the process can work simultaneously and they will not intervene each other
    whereas in
    Process interfaces
    at an time any one process can be active.
    Reward if usefull
    Cheers
    Snehi

  • Can I use Time Capsule for Time Machine and a place to put my iPhoto Library

    Can I use Time Capsule for Time Machine and a place to put my iPhoto Library?

    Only if you partition the Time Capsure into two partitions, one for TM and one for the iPhoto LIbrary.  But you won't be able to backup that library as it will be on the same drive as the TM backups.
    It's not recommended.  An alternative solution is to get another EHD, move the library to it and run it from there. Then TM can backup both your boot drive and the working EHD drive.
    OT

  • Can i use exfat format for my external western digital harddrive so that i can use in both windows and mac?

    can i use exfat format for my external western digital harddrive so that i can use in both windows and mac?
    thanks in advance.
    <Email Edited by Host>

    Yes you can. OS X version 10.6.6 and later can read/write exFAT. Windows XP SP3 and later can read/write exFAT. As posted by Radiation Mac, you can do it from Windows or from OS X.
    However, I've noticed Windows to be somewhat picky about drives formatted on a Mac. So, if Windows can't read it, try formatting it on the Windows machine, and see how it works on the Mac.
    Posting your email on a public forum isn't a very good idea. It will likely be harvested by spambots and used as the reply-to address for spam it sends out.
    Also, most people are not going to send an email to you for similar reasons. Nobody knows who you are, so sending an email to you could be giving a spammer a valid email address.
    The forum is set up to automatically notify you when there are responses to your questions. When you get one, you would log back into this forum and check to see what the answer was.

  • Can I use a substitute for the Sample Clock?

    I have three different analog inputs coming from one device (PCI-6221).  Two inputs are running at the same sample rate while the third needs a faster sample rate and a trigger.  I have these seperated as two seperate tasks but my problem is they both use the sample clock.  Can I use a substitute for the sample clock on the third channel?
    I am running LabVIEW 8.2 on Windows XP.
    Thanks in advance for your help.
    Ron Deavers, CLD

    Hi programmindragon,
    I understand you are trying to
    configure your PCI-6221 to sample on multiple channels, while having
    different rates and triggers for the channels. Unfortunately, you can
    only configure one analog input task to run at once and all the channels in
    the task must share the same configurations, including the sample clock
    and trigger. This is due to the fact that all the channels are
    multiplexed to a single amplifier and ADC on the device. Thus, you will
    not be able to configure the two inputs at one rate and use a different
    clock rate and trigger for the third input. Is it possible to sample at the
    maximum rate on all channels and decimate the data that you don't need on the certain
    channels, as well as share the same type of triggering? Hopefully you will be able to run your application with the same configuration across multiple channels, otherwise you may need multiple DAQ devices. Please let me know if you have any further questions related to this issue.
    Regards,
    Daniel S.
    National Instruments

Maybe you are looking for

  • 11i to R12 upgrade and Maintenance Wizard and the Maintenance Wizard Forum

    MetaLink doc 215527.1 recommends using the Maintenance Wizard to upgrade from 11i to R12. The Maintenance Wizard is extolled elsewhere in this Forum to replace the Upgrade Spreadsheet. And it is referenced a couple times in the 11i forum. But that's

  • Validation errors

    Hi, I don't do javascript - I just about manage the HTML (most times!). Anyway, I have been validating my site with wc3 and whilst I have corrected quite a bit (often thanks to this forum), I am stumped with the remaining 8 errors on my index page th

  • Find and Replace Japanese characters in pdf file on iPhone

    Hi eveybody ! I want to find and replace Japanese characters in pdf on iPhone. I using zlib to deflate stream - endstream block and extract text.It's work fine with latin-text. But when i work with japanese characters , I don't know how to do it ? I

  • Querying uncommitted session data in SQL Developer debugger

    I'm trying to analyze a large PL/SQL program that performs table creation, data insertion, and conditional updates to temporary tables. Is there a way to query the uncommitted data in the session in which the PL/SQL is running while stopped at a brea

  • Trouble publishing -  new site on new computer, want to replace old site.

    I got a new a new mac with iWeb 08 - was previously using 06. Re-built website on new computer, logged in to my account and hit publish. After loading all pages etc, got message "could not publish website". Have a feeling it may have something to do