Jeff,
You need to use a Left Join which will join rows from the second
table even if the rows from the second table does not exist, and returns
NULL for all column for the second table.. You then use the Where clause to
check for a particular Table2.field that should exist (like Id colum
Jeff Gannaway wrote:
I have 2 tables - ProductsOLD and ProductsNEW. I need to find the
records that are in the ProductsOLD table and are NOT in ProductsNEW
(this will tell me which products have been discontinued).
Here's some sample data:
+==+
| ProductsOLD |
+==+
+ Ve
I have 2 tables - ProductsOLD and ProductsNEW. I need to find the records
that are in the ProductsOLD table and are NOT in ProductsNEW (this will
tell me which products have been discontinued).
Here's some sample data:
+==+
| ProductsOLD |
+==+
+ Vendor | ID |
+---
--- Original Message -
From: "Martin Moss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 10:47 PM
Subject: Re: Select from one table where ID not in another table
> I'm not sure if I've described the exact results I want v
> 5,8,x,y,z,u,v,w,t
>
> This Works ok, HOWEVER, if Table2 Has no Data, the query returns NO results.
> What I want it to return is:-
> 1,8,x,y,z,u,v,w,t
> 2,8,x,y,z,u,v,w,t
> 3,8,x,y,z,u,v,w,t
> 4,8,x,y,z,u,v,w,t
> 5,8,x,y,z,u,v,w,t
>
> any Takers?
>
> Regards
>
uot; <[EMAIL PROTECTED]>
To: "Martin Moss" <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 10:27 PM
Subject: RE: Select from one table where ID not in another table
> Well, in order for that to work, you will need to do an explicit "JOIN"
> somewhere or
Moss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 3:54 PM
Subject: Select from one table where ID not in another table
> All,
>
> Am wondering if it's possible to do a query that does something like
this:-
>
> SELECT table1.*
select t1.* from table1 t1 LEFT JOIN table2 t2 on t1.id=t2.id WHERE t2.id IS
NULL
you can print out table2 values if you want, but they will all be NULL..
provided that table2.id and table1.id are the matches you are trying to find.
Kelley
Martin Moss wrote:
> All,
>
> Am wondering if it's p
r otherkeyid I still want to get
table1.*
Regards
Marty
- Original Message -
From: "Martin Moss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 9:49 PM
Subject: Select from one table where ID not in another table
> All,
>
&g
r otherkeyid I still want to get
table1.*
Regards
Marty
- Original Message -
From: "Martin Moss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 9:49 PM
Subject: Select from one table where ID not in another table
> All,
>
&g
TECTED]
-->Subject: Select from one table where ID not in another table
-->
-->All,
-->
-->Am wondering if it's possible to do a query that does something like
-->this:-
-->
-->SELECT table1.*,table2.id from Table1 AS table1,Table2 AS table2
-->WHERE table1
All,
Am wondering if it's possible to do a query that does something like this:-
SELECT table1.*,table2.id from Table1 AS table1,Table2 AS table2
WHERE table1.id DOESN'T EXIST IN table2.id;
Regards
Marty
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://ww
All,
Am wondering if it's possible to do a query that does something like this:-
SELECT table1.*,table2.id from Table1 AS table1,Table2 AS table2
WHERE table1.id DOESN'T EXIST IN table2.id;
Regards
Marty
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.
select a.* from a left join b on a.id = b.id
where b.id is null;
Ken Kinder wrote:
>
> Is there a way I can filter OUT records referenced in another table?
>
> With Subselects it would be this, but I'm using 3.23:
>
> select
> a.*
> from
> a
> where
> a.id not in (select id from b)
>
Is there a way I can filter OUT records referenced in another table?
With Subselects it would be this, but I'm using 3.23:
select
a.*
from
a
where
a.id not in (select id from b)
You get the idea.
-
Before posting, please
15 matches
Mail list logo