我正在尝试加入两个查询
查询1:
select ProposalTypeID
from tblAssessment
where AssessmentID = AssessmentID
查询2:
select AssessmentID
from tblAssessmentVersion
where AssessmentVersionID = 3
感谢您的指导,但我试图在存储过程中添加该查询以检索proposalTypeID
并在我的存储过程中使用但它抱怨
SELECT
AssessmentEcosystemCreditID, AssessmentVersionID,
dbo.tblAssessmentEcosystemCredit.ManagementZoneID,
(SELECT ProposalTypeID
FROM tblAssessment
WHERE AssessmentID = (SELECT AssessmentID
FROM tblAssessmentVersion
WHERE AssessmentVersionID = dbo.tblAssessmentEcosystemCredit.AssessmentVersionID)) AS ProposalTypeID,
CASE
WHEN SiteValueCurrentScore <= 17 AND (dbo.tblVegetationZone.EECID > 0 ) AND (ProposalTypeID=699)
THEN 0
ELSE NumberOfCredits
END AS NumberOfCreditst
FROM
dbo.tblAssessmentEcosystemCredit
INNER JOIN
dbo.tblVegetationType ON dbo.tblAssessmentEcosystemCredit.VegTypeID = dbo.tblVegetationType.VegTypeID
INNER JOIN
dbo.tblManagementZone ON dbo.tblAssessmentEcosystemCredit.ManagementZoneID = dbo.tblManagementZone.ManagementZoneID
INNER JOIN
dbo.tblVegetationZone ON dbo.tblVegetationZone.VegetationZoneID = dbo.tblManagementZone.VegetationZoneID
WHERE
dbo.tblAssessmentEcosystemCredit.AssessmentVersionID = @AssessmentVersionID
答案 0 :(得分:2)
所以?
select ProposalTypeID
from tblAssessment
where AssessmentID in
(select AssessmentID
from tblAssessmentVersion
where AssessmentVersionID=3)
答案 1 :(得分:1)
select ProposalTypeID
from tblAssessment
where AssessmentID = (select AssessmentID
from tblAssessmentVersion
where AssessmentVersionID = 3)