SQL left join returns null column I am trying to do a LEFT JOIN on two tables, where one table has a datetime column, and the other table has a date column. As I am working in SQL Server, I used CONVERT to change the datetime to date. I then wrote the join statement:

SELECT CONVERT(date,db1.dbo.table1.datecolumn), db2.dbo.table2.datecolumn
FROM db1.dbo.table1
LEFT JOIN db2.dbo.table2 
    ON db1.dbo.table1.datecolumn = db2.dbo.table2.datecolumn


And the query returns the date column from table1, but the column from table2 is populated with NULL values only. I am not sure what I am doing wrong. I tried CAST instead of CONVERT, with no luck. Is there something happening with the conversion? Any help is appreciated.
You're doing the convert() in the wrong place I guess. You have to do it in the equals operation of the ON, it's still a datetime there, regardless of what you do on it in the list of selected columns.

Try:

SELECT CONVERT(date,db1.dbo.table1.datecolumn), db2.dbo.table2.datecolumn
FROM db1.dbo.table1
LEFT JOIN db2.dbo.table2 
    ON CONVERT(date,db1.dbo.table1.datecolumn) = db2.dbo.table2.datecolumn