Help for mysql Join
Hello !!
I need help fot the following situation:
I have 2 tables: test1 and test2:
each one have the same columns name: data
test1:
column data
values (black, white)
test2:
column data
values(white,black,orange, yellow)
what sql sentence i can use to show only the values (orange, yellow) the difference between the 2 tables?
Related Article: Problem with MYSQL Join
is a MySQL discussion thread by grant.baker that has 1 reply, was last updated 3 months ago and has been tagged with the keywords: inefficient, mysql, join.
jeyjey88
Newbie Poster
2 posts since Mar 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Are you looking for this?
SELECT * FROM test1, test2 WHERE test1.data!=test2.data
mwasif
Posting Whiz
315 posts since Dec 2007
Reputation Points: 29
Solved Threads: 48
Skill Endorsements: 0
Try this
SELECT test1.data FROM test1 JOIN test2 ON test1.data!=test2.data
anand01
Posting Whiz in Training
288 posts since Aug 2010
Reputation Points: 12
Solved Threads: 22
Skill Endorsements: 0
Thanks to everyone for replying to my questions!
All seems to work fine.
but particulary i have tried this one:
SELECT DISTINCT test1.data
FROM test1.data
WHERE (test1.data) NOT IN
(SELECT test2.data FROM test2)
it´s a bit more flexible.
jeyjey88
Newbie Poster
2 posts since Mar 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by
mwasif
and
anand01