Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion NOT IN
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Charles Hooper  
View profile  
 More options Jul 4 2007, 9:26 am
Newsgroups: comp.databases.oracle.misc
From: Charles Hooper <hooperc2...@yahoo.com>
Date: Wed, 04 Jul 2007 06:26:36 -0700
Local: Wed, Jul 4 2007 9:26 am
Subject: Re: NOT IN
On Jul 4, 8:47 am, colmkav <colmj...@yahoo.co.uk> wrote:

> is it possible to write an SQL Oracle query where you want to check
> whether a combination of fields exist in another query

> eg I tried the following but got an error:

> select count(*) from tmp_risk_sum where book, strategy, exposuretypeid
> not in (select book, strategy, exposuretypeid from tmp_risk_sum_ORACLE)

SELECT
  COUNT(*)
FROM
  TMP_RISK_SUM
WHERE
  (BOOK,STRATEGY,EXPOSURETYPEID) NOT IN (
    SELECT
      BOOK,
      STRATEGY,
      EXPOSURETYPEID
    FROM
      TMP_RISK_SUM_ORACLE);

You may find that this syntax executes more efficiently:
SELECT
  COUNT(*)
FROM
  TMP_RISK_SUM S,
  (SELECT DISTINCT
    BOOK,
    STRATEGY,
    EXPOSURETYPEID
  FROM
    TMP_RISK_SUM_ORACLE) SO
WHERE
  S.BOOK=SO.BOOK(+)
  AND S.STRATEGY=SO.STRATEGY(+)
  AND S.EXPOSURETYPEID=SO.EXPOSURETYPEID(+)
  AND SO.BOOK IS NULL;

Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.