Iamthestig
Programmer
Can someone please help me out with this query. I get a error because one of the rows has an empty space in the YearEnd column.
YearEnd is a varchar(7)
Thanks for any help.
Code:
SELECT
a.FirstName + ' ' + a.LastName AS FullName,
a.Initial,
a.Age,
b.Level2Company,
b.YearEnd,
FROM tblContacts a
INNER JOIN
tblSalary AS b ON a.CREF = b.CREF
WHERE
a.CREF = @CREF AND CAST('01/' + b.YearEnd AS DATE) =
(SELECT Max(CAST('01/' + c.YearEnd AS DATE)) FROM tblSalary c WHERE c.CREF = @CREF)
YearEnd is a varchar(7)
Thanks for any help.