NigelRocks
asked on
Multi-Part Identifier Missing
Experts,
The attached stored proc is getting an error on t.MemberGUID:
"The multi-part identifier 't.MemberGUID" could not be found."
The last time I has this error, it was becasue I was referencing a field without referencing the table in the FROM clause. This is clearly not the case here. Ideas?
The attached stored proc is getting an error on t.MemberGUID:
"The multi-part identifier 't.MemberGUID" could not be found."
The last time I has this error, it was becasue I was referencing a field without referencing the table in the FROM clause. This is clearly not the case here. Ideas?
SELECT Member.MemberID, '01/01/1900' as servicedate
, 'HRA-Triglyceride' as loincCode,null as cpt_Code
, a.hramadAnswer as llc_Value
FROM HRAMemAnswerData a WITH(NOLOCK), PopulationTask t, HRAGroupQuestions gq, HRAQuestion q
INNER JOIN Member ON Member.MemberGUID=t.MemberGUID
where a.PopulationTaskID = t.PopulationTaskID And a.HragqID = gq.HragqID
And gq.HragqChildqID = q.HraqID and hraqid = 19 and Member.MemberID = @MemberID
AND T.Active = 0
AND LEFT(a.hramadAnswer, 3) = 'Yes' AND LTRIM(RTRIM(SUBSTRING(a.hramadAnswer, 5, LEN(a.hramadAnswer)))) != '' and Member.ClientID = @ClientID and Member.MemberID = @MemberID ORDER BY ServiceDate DESC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Silly question, but: is there a field called MemberGUID in the table PopulationTask? - MemberID is used elsewhere in the query
I cleaned up the query a bit to see what it was doing. (Making inner joins out of classical joins, removing duplicate MemberID conditions...) You haven't specified which table the hraqid and ServiceDate fields come from., but other than that it's pretty clear where everything comes from.
Check that you actually have a MemberGUID field in the PopulationTask table, and that you have spelled it correctly.
Check that you actually have a MemberGUID field in the PopulationTask table, and that you have spelled it correctly.
select
m.MemberID,
'01/01/1900' as servicedate,
'HRA-Triglyceride' as loincCode,
null as cpt_Code,
a.hramadAnswer as llc_Value
from
HRAMemAnswerData a WITH(NOLOCK),
inner join PopulationTask t on t.PopulationTaskID = a.PopulationTaskID
inner join HRAGroupQuestions gq on gq.HragqID = a.HragqID
inner join HRAQuestion q on q.HraqID = gq.HragqChildqID
inner join Member m ON m.MemberGUID = t.MemberGUID
where
hraqid = 19 and
t.Active = 0 and
left(a.hramadAnswer, 3) = 'Yes' and
ltrim(rtrim(substring(a.hramadAnswer, 5, len(a.hramadAnswer)))) != '' and
m.ClientID = @ClientID and
m.MemberID = @MemberID
order by
ServiceDate desc