Possible Duplicate:
The multi-part identifier could not be bound可能重复:无法绑定多部分标识符
This is my query that doesn't want to work.
这是我不想工作的查询。
It says: The multi-part identifier "dbo.RunSequenceBatch.RunSequenceBatchName" could not be bound.
它说:无法绑定多部分标识符“dbo.RunSequenceBatch.RunSequenceBatchName”。
Could you please advise?
您能否提一些建议?
Thanks in advance!!! :)
提前致谢!!! :)
SELECT '30 May' AS [Date],
[RunSeq].[RunSequenceBatchName] AS [Batch Job Name] ,
RunSeqCat.CategoryDescription AS [Development Name] ,
[Systems].SystemName AS [System Area] ,
CAST((SUM(DumpSM37_Env3.Duration) / 60) AS NUMERIC(10, 2)) AS [Duration (mins)]
FROM [dbo].[RunSequenceBatch] AS RunSeq
LEFT JOIN DumpSM37_Env3 ON ([RunSeq].[RunSequenceBatchName] = DumpSM37_Env3.[Job]
AND DumpSM37_Env3.[ImportDate] BETWEEN '30 May 2012 00:00:00' AND '30 May 2012 23:59:59'),
[dbo].[RunSequenceType] AS RunSeqType,
[dbo].[RunSequenceFrequency] AS RunSeqFrequency,
RunSequenceCategory AS RunSeqCat, Category, [Systems]
WHERE RunSeq.Status = 'Active'
AND RunSeqFrequency.RunSequenceBatchID = RunSeq.RunSequenceBatchID
AND RunSeq.RunSequenceTypeID = RunSeqType.RunSequenceTypeID
AND RunSeqCat.CategoryDescription = Category.Description
AND Category.SystemArea = [Systems].SystemID
AND DumpSM37_Env3.[Duration] > 0
AND RunSeq.RunSequenceTypeID = 1
AND RunSeqCat.RunSequenceBatchID = RunSeq.RunSequenceBatchID
GROUP BY dbo.RunSequenceBatch.RunSequenceBatchName, DumpSM37_Env3.WorkerProcessID,
ORDER BY [RunSeqFrequency].[Frequency] ASC,
[RunSeqFrequency].[StartTime] ASC
1 个解决方案
#1
13
Basically, you've mismatched your table names.
基本上,你的表名不匹配。
In your FROM
you have:
在你的FROM你有:
FROM [dbo].[RunSequenceBatch] AS RunSeq
You're aliasing [dbo].[RunSequenceBatch]
In other words, you're stating that from here on out, [dbo].[RunSequenceBatch]
will be referred to as RunSeq
你是别名[dbo]。[RunSequenceBatch]换句话说,你说从现在开始,[dbo]。[RunSequenceBatch]将被称为RunSeq
But in your GROUP BY
you don't refer to it using the alias. Because the alias in the only exposed name in the query, dbo.RunSequenceBatch
can't be bound.
但是在GROUP BY中,您不使用别名来引用它。因为别名在查询中只有暴露的名称,所以dbo.RunSequenceBatch不能绑定。
Change
GROUP BY dbo.RunSequenceBatch.RunSequenceBatchName
to
GROUP BY RunSeq.RunSequenceBatchName
And you'll be fine.
你会没事的。
#1
13
Basically, you've mismatched your table names.
基本上,你的表名不匹配。
In your FROM
you have:
在你的FROM你有:
FROM [dbo].[RunSequenceBatch] AS RunSeq
You're aliasing [dbo].[RunSequenceBatch]
In other words, you're stating that from here on out, [dbo].[RunSequenceBatch]
will be referred to as RunSeq
你是别名[dbo]。[RunSequenceBatch]换句话说,你说从现在开始,[dbo]。[RunSequenceBatch]将被称为RunSeq
But in your GROUP BY
you don't refer to it using the alias. Because the alias in the only exposed name in the query, dbo.RunSequenceBatch
can't be bound.
但是在GROUP BY中,您不使用别名来引用它。因为别名在查询中只有暴露的名称,所以dbo.RunSequenceBatch不能绑定。
Change
GROUP BY dbo.RunSequenceBatch.RunSequenceBatchName
to
GROUP BY RunSeq.RunSequenceBatchName
And you'll be fine.
你会没事的。