当我尝试在SSRS的文本框中运行select语句时收到此错误。所以,基本上,我试图返回一个不在给定数据集中的字段。所以我运行了一个子查询,它使用现有数据集作为容器返回值。
但我不知道如何在表达式字段中表示该返回值。因为表达式字段返回的值在提供的数据集中。
我提供了我编写的SQL。
任何建议将不胜感激。
我的目的是返回“CommentText”值。但是,数据集不包含任何commenttext字段,而是包含EmpID字段。所以我创建了下面的子查询,它从LaborDtlComment表中调出CommentText,当它与报表数据集中的EmpID匹配时,它返回CommentText值。
select [CommentReturnQuery].[LaborDtlComment_CommentText] as [LaborDtlComment_CommentText],
[EmpBasic].[EmpID] as [EmpBasic_EmpID]
from Erp.EmpBasic as EmpBasic
inner join (select [LaborDtlComment].[CommentText] as [LaborDtlComment_CommentText],
[LaborDtl].[EmployeeNum] as [LaborDtl_EmployeeNum]
from Erp.LaborDtlComment as LaborDtlComment
inner join Erp.LaborDtl as LaborDtl on LaborDtlComment.Company = LaborDtl.Company
and LaborDtlComment.LaborHedSeq = LaborDtl.LaborHedSeq
and LaborDtlComment.LaborDtlSeq = LaborDtl.LaborDtlSeq) as CommentReturnQuery
on EmpBasic.EmpID = CommentReturnQuery.LaborDtl_EmployeeNum
我的目标是在文本字段中显示CommentText值。所以我会创建
文本字段,它将包含我编写的SQL。谁能帮忙
我在这种情况下?
使用SSRS函数查找(单对1对1)或查找集(多对1对多)可能更简单.microsoft lookup reference
您必须创建查询/数据集以使用EmpID从LaborDtlComment表返回CommentText