List:General Discussion« Previous MessageNext Message »
From:Toni Date:October 17 2002 4:17am
Subject:Re: comparing tables -> continue
View as plain text  
Thank you Peter, it does work,

I have some question again if you don't mind. Let say i have similiar tables
like before, but i will add another field for "pick". They will become like
this :

 Table "Master"       Table "Pick"
 m                           p   q
-----                       ------
 a                            a   x
 b                            b   x
 c                            c   x
 d                            d   x
 e                            b   y
 f                             g   y
 g

now, the goal is to know any data that missing in table "pick" wearing
atribut "y" (b,g) comparing to table "master". The answer should be
"a,c,d,e,f". Would you please once again help me to modify the query before?

FYI, I try to add some conditional phrase :

select m from master
left join pick on master.m = pick.p
where pick.q = 'y' and pick.p is null

but it doesn't work. oh ya, I use MySQL 3.23.45

thank you so much

Toni

---------------------------- < finish > -----------------------
Toni wrote :

> i have a problem to compare data inside two tables. i have two tables let
> say: "Master" and "Pick". For example the content of these two tables are:
>
> Table "Master"         Table "Pick"
> a                            a
> b                            b
> c                            c
> d                            d
> e
> f
> g
>
> my goal is to know any data that missing in table "pick" comparing to
table
> "master". The answer should be "e, f, and g". Would you help me to show me
> the query?
>
> thank you so much ..

Assuming field m in master and p in pick...
    SELECT m from master
    LEFT JOIN pick on master.m=pick p
    WHERE pick.p IS NULL

PB



Thread
Re: comparing tables -> continueToni17 Oct