Did you mean to use lower case L instead of the digit 1 as the table alias? Change to one of these--compare the resultsSELECT [1].wait_type, ([1].wait_time_ms - O.wait_time_s) accum_wait_ms --red squigly line under wait_time_ms on this lineFROM #OriginalWaitSnapshot OINNER JOIN #LatestWaitStatSnapshot [1] ONO.wait_type = [1].wait_typeWHERE [1].wait_type_ms > O.wait_time_msORDER BY [1].wait_time_ms DESC
Or,--compare the resultsSELECT x.wait_type, (x.wait_time_ms - O.wait_time_s) accum_wait_ms --red squigly line under wait_time_ms on this lineFROM #OriginalWaitSnapshot O INNER JOIN #LatestWaitStatSnapshot x ON O.wait_type = x.wait_typeWHERE x.wait_type_ms > O.wait_time_msORDER BY x.wait_time_ms DESC