May 16, 2016 at 8:10 am
Both of those queries work because they are essentially the same thing.
You should probably work to understand those queries so that you can modify them to return the columns that you want.
Here is my solution (which also works), modified to return the distinct employee numbers:
SELECT
DISTINCT IsNull(Employee.[Emp_no.], Class.[Emp_no.])
FROM
#Employee Employee
FULL OUTER JOIN
#Class Class
ON
IsNull(Employee.[Emp_no.], '') = IsNull(Class.[Emp_no.], '')
ANDIsNull(Employee.Org_Code, '') = IsNull(Class.Org_Code, '')
ANDIsNull(Employee.Org_Num, '') = IsNull(Class.Org_Num, '')
WHERE
(
Employee.[Emp_no.] IS NULL
AND Employee.Org_Code IS NULL
AND Employee.Org_Num IS NULL
)
OR
(
CLASS.[Emp_no.] IS NULL
AND CLASS.Org_Code IS NULL
AND CLASS.Org_Num IS NULL
)
May 16, 2016 at 10:26 am
Below query gives error message: Incorrect Syntax near 'NULL' on Last line of the code
SELECT
DISTINCT IsNull(Employee.[Emp_no], Class.[Emp_no])
FROM
Employee
FULL OUTER JOIN
Class
ON
IsNull(Employee.[Emp_no], '') = IsNull(Class.[Emp_no], '')
ANDIsNull(Employee.Org_Code, '') = IsNull(Class.Org_Code, '')
ANDIsNull(Employee.Org_Num, '') = IsNull(Class.Org_Num, '')
WHERE
(
Employee.[Emp_no] IS NULL
AND Employee.Org_Code IS NULL
AND Employee.Org_Num IS NULL
)
OR
(
CLASS.[Emp_no] IS NULL
AND CLASS.Org_Code IS NULL
AND CLASS.Org_Num IS NULL
May 16, 2016 at 11:32 am
That is because you are missing the last parenthesis.
Viewing 3 posts - 31 through 33 (of 33 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy