DATEDIFF(hh, CAST(d_in.Value AS date) + ' ' + CAST(h_in.Value AS time), CAST(d_dx.Value AS date) + ' ' + CAST(h_dx.Value AS time) )