Monday, 15 September 2014

sql - trying to join two queries and retrieve a column -



sql - trying to join two queries and retrieve a column -

i trying bring together 2 queries

query 1:

select proposaltypeid tblassessment assessmentid= assessmentid

query 2:

select assessmentid tblassessmentversion assessmentversionid=3

thanks guidence trying add together query in store proc retrieve proposaltypeid , utilize in store proc complains

select assessmentecosystemcreditid, assessmentversionid, dbo.tblassessmentecosystemcredit.managementzoneid, (select proposaltypeid tblassessment assessmentid = (select assessmentid tblassessmentversion assessmentversionid=dbo.tblassessmentecosystemcredit.assessmentversionid)) proposaltypeid, case when sitevaluecurrentscore<=17 , (dbo.tblvegetationzone.eecid > 0 ) , (proposaltypeid=699) 0 else numberofcredits end numberofcreditst dbo.tblassessmentecosystemcredit inner bring together dbo.tblvegetationtype on dbo.tblassessmentecosystemcredit.vegtypeid = dbo.tblvegetationtype.vegtypeid inner bring together dbo.tblmanagementzone on dbo.tblassessmentecosystemcredit.managementzoneid = dbo.tblmanagementzone.managementzoneid inner bring together dbo.tblvegetationzone on dbo.tblvegetationzone.vegetationzoneid = dbo.tblmanagementzone.vegetationzoneid dbo.tblassessmentecosystemcredit.assessmentversionid= @assessmentversionid

so?

select proposaltypeid tblassessment assessmentid in (select assessmentid tblassessmentversion assessmentversionid=3)

sql

No comments:

Post a Comment