Re: Help: SQL .*Not IN* alternatives
Posted in 1994
In article <39dp75$d17@emory.mathcs.emory.edu>, DONALD_BOOTHBY@IMA.ISD.STATE.IN.US says:
>
> I have a user with two flat files who is trying to find data in one
> table that is not in the other.
>...
> He used the following SQL:
> SELECT DISTINCT "idms"."ssn", "idms"."lastname", "idms"."firstname",
> "idms"."mi", "idms"."ssaciid", "idms"."college", "idms"."initials"
> FROM "idms", "ncs"
!!!!!!!
> WHERE ( "idms"."ssn" NOT IN (SELECT DISTINCT "ncs"."ssn" from
> "ncs"))
> ORDER BY "idms"."college" ASC>
> but since these files are large, it was still chugging along 4 hours
>....
You dont need the table "ncs" in the first FROM-list !
There are no columns of this table in your SELECT-list or any
DIRECT condition. The SUBQUERY is NOT a direct condition.
########################################################
# ____ ____ ____ #
# | _ | | | | | Michael Lackowski #
# | (_)| | | | | #
# | ___| _| _|__| _| IVU GmbH #
# |( (_ \\ ( (_ | (_ | Bundesallee 129 #
# | | | \\ \\/ /| | | | D-12161 Berlin #
# | | | \\ /|| |__| | #
# |(____) |\\_/ |\\________) phone : +49 30 850006-37 #
# | | | | | | fax : +49 30 850006-66 #
# |____| |____| |____| e-mail: ml@ivu-berlin.de #
# #
########################################################