在下面的查询中,第一个FROM检索CodLabel的值,其中CodRcdTyp ='MGMAST'的值 第二个FROM检索CodLabel的值,其中CodRcdTyp ='PMTMAS'
如何为要在表达式中使用的第二个CodLabel分配不同的字段名称? AS TypeCodLabel之类的东西
SELECT
tblDataActions.ApplicationNumber
,tblDataActions.CompletionDate
,tblDataActions.Actions
,tblDataPermit.ApplicationType
,tblDataActions.ActionStatus
,tblDataPermit.Type
,tblDataPermit.Applicant
,SysCod.CodRcdTyp
,SysCod.CodLabel
FROM
SysCod
INNER JOIN tblDataActions
ON SysCod.CodCode = tblDataActions.ActionStatus
INNER JOIN tblDataPermit
ON tblDataPermit.ApplicationNumber = tblDataActions.ApplicationNumber
WHERE
tblDataActions.ApplicationNumber = @ApplicationNumber
AND SysCod.CodRcdTyp = 'MGMAST'
FROM
SysCod
INNER JOIN tblDataPermit
ON SysCod.CodOrder = tblDataPermit.Type
INNER JOIN tblDataActions
ON tblDataActions.ApplicationNumber = tblDataPermit.ApplicationNumber
WHERE
tblDataActions.ApplicationNumber = @ApplicationNumber
AND SysCod.CodRcdTyp = 'PMTMAS'
答案 0 :(得分:0)
我必须像这样设置第二个数据集查询:
SELECT
SysCod.CodLabel
,SysCod.CodCode
FROM
SysCod
INNER JOIN tblDataActions
ON tblDataActions.ActionStatus = SysCod.CodCode
WHERE tblDataActions.ApplicationNumber = @ApplicationNumber
AND CodRcdTyp = 'MGMAST'
和第三个DataSet查询,如下所示:
{{1}}