Article View: borland.public.interbase.sql
Article #463Re: How to select records not present in either two similar tables
From: Bill Todd
Date: Sun, 25 Nov 2007 13:53
Date: Sun, 25 Nov 2007 13:53
18 lines
1525 bytes
1525 bytes
Monalee Bhandge wrote: > ANS---> > suppose first table name is emp1 & second one is emp2 then you > query should be like--------- > > SELECT emp1.emp_name, emp1.address FROM emp1, emp2 > WHERE emp1.emp_id=emp2.emp_id; Your query will return all of the records that exist in both tables. To get the records that are present in emp1 but not in emp2 use: SELECT EMP1.EMPID FROM EMP1 LEFT OUTER JOIN EMP2 ON EMP1.EMP_ID = EMP2.EMP_ID WHERE EMP2.EMP_ID IS NULL -- Bill Todd (TeamB)
Technical Details
Message-ID:
<47498c74$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<op.t13wz0jinnuxdn@salaxp> <47492e25$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,69fa63958f1f7eb3
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bill Todd" <no@no.com>
Subject: Re: How to select records not present in either two similar tables
Newsgroups: borland.public.interbase.sql
References: <op.t13wz0jinnuxdn@salaxp> <47492e25$1@newsgroups.borland.com>
Organization: The Database Group, Inc.
User-Agent: XanaNews/1.18.1.6
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
NNTP-Posting-Host: 65.118.176.23
Message-ID: <47498c74$1@newsgroups.borland.com>
Date: 25 Nov 2007 06:53:40 -0700
X-Trace: newsgroups.borland.com 1196002420 65.118.176.23 (25 Nov 2007 06:53:40 -0700)
Lines: 18
X-Authenticated-User: btodd
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail