我想在表变量和视图之间建立INNER JOIN
SELECT
T. *
FROM
@mytable AS T, Vw_GetPackageStat.DimensionValueName
From
dbo.Vw_GetPackageStat
INNER JOIN
T ON (dbo.Vw_GetPackageStat.AttributeValueID = T.AttributeValueID)
我有这个错误
关键字'来自'
附近的语法不正确
答案 0 :(得分:2)
SELECT T.* ,
Vw_GetPackageStat.DimensionValueName
FROM @AllPackage AS T
INNER JOIN dbo.Vw_GetPackageStat ON ( dbo.Vw_GetPackageStat.AttributeValueID = T.AttributeValueID )
答案 1 :(得分:0)
使用此
SELECT T.* ,
Vw_GetPackageStat.DimensionValueName
FROM @AllPackage AS T
INNER JOIN dbo.Vw_GetPackageStat ON
Vw_GetPackageStat.AttributeValueID = T.AttributeValueID
答案 2 :(得分:0)
我认为你原本是想这么做的
SELECT T.*
,Vw_GetPackageStat.DimensionValueName
FROM @mytable AS T
,Vw_GetPackageStat
WHERE dbo.Vw_GetPackageStat.AttributeValueID = T.AttributeValueID
这是一种有效的语法,但我会不惜一切代价避免它。而是使用传统的显式INNER JOIN
SELECT T.*
,v.DimensionValueName
FROM @mytable AS T
INNER JOIN Vw_GetPackageStat AS v
ON T.AttributeValueID = V.AttributeValueID