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?

Recommended Answers

All 3 Replies

Are you looking for this?

SELECT * FROM test1, test2 WHERE test1.data!=test2.data

Try this

SELECT test1.data FROM test1 JOIN test2 ON test1.data!=test2.data

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.