-
SELECT <>from 2 TABLES
I am trying to find a way to get all the different value from 2 TABLE
SELECT DISTINCT users.name FROM users INNER JOIN localisation
ON users.name <> localisation.name
WHERE users.name IS NOT NULL
i need only all the DISTINCT users.name <> localisation.name
i dont get it with INNER LEFT RIGH FULL JOIN
thank you for helping
-
Can you clarify further with a sample. You are returning almost a cartesian product with inequality join.
-
I just want to get all the users.name <> localisation.name FROM users
-
--find all names in Users table that do NOT exist in Localisation table
SELECT DISTINCT (us.name)
FROM Users us LEFT JOIN Localisation loc ON us.name = loc.name
WHERE loc.name IS NULL
AND us.name IS NOT NULL
--Find all names in Localisation table that do NOT exist in Users table
UNION
SELECT DISTINCT (loc.name)
FROM Localisation loc LEFT JOIN Users us ON loc.name = us.name
WHERE us.name IS NULL
AND loc.name IS NOT NULL
--HTH--
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|