Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Reference a temp column in a inner join

$
0
0

Hello all, I have a temp column called Tempfield that I am trying to use in a inner join to help me match up data from a different table.

The code I am trying to work with is:
Text
SELECT RTRIM(ORDUNIQ), RTRIM(ITEM), LEFT(ITEM,2) AS Tempfield, RTRIM(dbo.Class.Class)
FROM dbo.MAINTBL INNER JOIN dbo.Class ON dbo.MAINTBL.Tempfield = dbo.Class.Class 
WHERE ORDUNIQ = @get_orduniq
Does anyone know how to use a temp field to help make this inner join work so I can get the data I need from the Class table?

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>