BiggerBrother
Technical User
I know this returns all the records in a field, and that it is the longest way to return these records, but it is the product of 2 built statements, so there is reason behind the madness.
(
SELECT DISTINCT contact. *
FROM contact
LEFT OUTER JOIN location ON ind_id = loc_indid
WHERE loc_id IS NULL
)
UNION (
SELECT DISTINCT contact. *
FROM contact
LEFT OUTER JOIN location ON ind_id = loc_indid
WHERE loc_id IS NOT NULL
)
Bascially, the first statement selects all entries in contact which do not appear in location, and the second does the reverse.
At the moment, the two statements work independantly, but once I add the UNION statemnet, it returns an error in the string after UNION. Where am I going wrong??
BB
(
SELECT DISTINCT contact. *
FROM contact
LEFT OUTER JOIN location ON ind_id = loc_indid
WHERE loc_id IS NULL
)
UNION (
SELECT DISTINCT contact. *
FROM contact
LEFT OUTER JOIN location ON ind_id = loc_indid
WHERE loc_id IS NOT NULL
)
Bascially, the first statement selects all entries in contact which do not appear in location, and the second does the reverse.
At the moment, the two statements work independantly, but once I add the UNION statemnet, it returns an error in the string after UNION. Where am I going wrong??
BB