RIAS
asked on
Sql query
Hello,
I am using a query
SELECT E.EmployeeID, E.Firstname,E.Lastname,E.D atejoined FROM
B35_Employees E INNER JOIN B35_Cars C
ON E.EmployeeID = C.EmployeeID
WHERE (C.RegistrationNumber is not null and C.RegistrationNumber <> '')order by E.Lastname ASC
which is returning duplicate rows
4 HQU A 2000-01-01 00:00:00.000
2 CDE B 2000-12-13 00:00:00.000
3 HIU B 1998-03-01 00:00:00.000
1 ABC C 2008-01-12 00:00:00.000
1 ABC C 2008-01-12 00:00:00.000
1 ABC C 2008-01-12 00:00:00.000
Any suggestion on using left join so that I dont get the repetition.
Cheers
I am using a query
SELECT E.EmployeeID, E.Firstname,E.Lastname,E.D
B35_Employees E INNER JOIN B35_Cars C
ON E.EmployeeID = C.EmployeeID
WHERE (C.RegistrationNumber is not null and C.RegistrationNumber <> '')order by E.Lastname ASC
which is returning duplicate rows
4 HQU A 2000-01-01 00:00:00.000
2 CDE B 2000-12-13 00:00:00.000
3 HIU B 1998-03-01 00:00:00.000
1 ABC C 2008-01-12 00:00:00.000
1 ABC C 2008-01-12 00:00:00.000
1 ABC C 2008-01-12 00:00:00.000
Any suggestion on using left join so that I dont get the repetition.
Cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Just executed the query
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ','.
Cheers
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ','.
Cheers
Double-click on the error message, watch the cursor jump to the offending line, then tell us what line that is. Looking at the code I posted I don't see any orphan commas that would cause that error.
ASKER