Compare data between 2 rows of same table I have a table that looks like this:  

date1                   date2   
2017-03-06 17:02:00     null  
2017-03-06 17:02:00     2017-02-17 11:20:00  
2017-03-01 17:07:00     2017-03-13 17:07:00  
2017-03-17 12:05:00     null  
2017-01-24 11:45:00     null     


Which join should I use to output 1 column of data that only shows the date1 in the result and if there is a value in date2 column, it will show the date2 value instead of the date1 value?
Based on your requirement if both columns are in the same table we could use ISNULL to achieve this output?

e.g.

select ISNULL(date2, date1) as CalcDate
from &lt;table&gt;


Results:

CalcDate
2017-03-06 17:02:00.000
2017-02-17 11:20:00.000
2017-03-13 17:07:00.000
2017-03-17 12:05:00.000
2017-01-24 11:45:00.000