当我试图在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。有人能帮上忙吗
在这种情况下是我?
发布于 2019-03-29 16:55:39
使用SSRS函数lookup (一对1对1)或lookup(多对多对多)可能更简单。microsoft lookup reference
您必须创建查询/数据集以使用EmpID从LaborDtlComment表返回CommentText
https://stackoverflow.com/questions/55411931
复制相似问题