Hey guys, I'm trying to reach some table variables with the help of outer apply. The query i got so far is this.
Code SQL:SELECT T.Firstcol, T.Secondcol, Z.Timmar, B.Timmar, C.Timmar, D.Timmar FROM @tble AS Z, @tble3 AS B, @tble4 AS C, @tble5 AS D OUTER APPLY (SELECT TOP 1 L.Timmar FROM @tble2 AS L INNER JOIN Z (NOLOCK) ON A.Personnummer = T.PNRCol OR B.Personnummer = T.PNRCol) AS tempres
Is there any way to make this query work?
Error message
Invalid object name 'Z'.


Reply With Quote







Bookmarks