When i run the sql query shows error [Resolved]

Posted by Narasiman under Sql Server on 3/12/2015 | Points: 10 | Views : 389 | Status : [Member] | Replies : 1
select First.course,second.Certificate_No,second.Issue_Authority,second.Issue_Date
from
(select distinct Course = case cr.cpm_pkg_id WHEN '' THEN cr.cmn_minor_code else cbm.cmn_minor_code end
from course_registration cr, batch_course_registration bcr, co_batch_master cbm where
bcr.cr_bill_no = cr.cr_bill_no and cbm.cbm_batch_id = bcr.bcr_batch_id and cr.cr_active = 'A' and
cr.stud_id = '9917') as first
left join
(select distinct b.courseelg,b.coursename,a.pm_prof_code as Code,a.sp_cert_no as Certificate_No,
a.sp_issu_authority as Issue_Authority, convert(char(14),a.sp_issu_dt,106) as Issue_Date from student_professional a,tb_courseelg_settings b
where a.pm_prof_code= b.courseelg and first.course = b.coursename and a.stud_id = '9917' ) as second
ON(second.coursename=first.Course)

When i run the above query shows error as follows

The multi-part identifier "first.course" could not be bound.

From my above query what is the mistake i made
please help me




Responses

Posted by: Bandi on: 3/13/2015 [Member] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
Query looks good.... i suspect on case sensitive column name.....

may be run the query by having below code

select first.Course  ,second.Certificate_No,second.Issue_Authority,second.Issue_Date 
from
(select distinct Course = case cr.cpm_pkg_id WHEN '' THEN cr.cmn_minor_code else cbm.cmn_minor_code end
from course_registration cr, batch_course_registration bcr, co_batch_master cbm where
bcr.cr_bill_no = cr.cr_bill_no and cbm.cbm_batch_id = bcr.bcr_batch_id and cr.cr_active = 'A' and
cr.stud_id = '9917') as first
left join
(select distinct b.courseelg,b.coursename,a.pm_prof_code as Code,a.sp_cert_no as Certificate_No,
a.sp_issu_authority as Issue_Authority, convert(char(14),a.sp_issu_dt,106) as Issue_Date from student_professional a,tb_courseelg_settings b
where a.pm_prof_code= b.courseelg and first.course = b.coursename and a.stud_id = '9917' ) as second
ON(second.coursename=first.Course)


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Narasiman, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response