With regards to performance and repetative code - the client client questioned the use of the inner join ??
This is what the client sent to me - what is wrong with it or how could it be improved??
select person_key, questions.question_id question_key, question_priority,
max(responses.response_text) response_text,max(responses.created_date) created_date
into #temp_responses
from lp_uat.responses
INNER JOIN lp_uat.questions on responses.question_key = questions.question_id
where(responses.created_date) in (
select max(responses.created_date) from lp_uat.responses
INNER JOIN lp_uat.questions on responses.question_key = questions.question_id
where question_id in (22,23,24,32,2,3)
group by question_id, person_key, question_key )
and question_id in (22,23,24,32,2,3)
group by question_id, person_key, question_priority
This is what the client sent to me - what is wrong with it or how could it be improved??
select person_key, questions.question_id question_key, question_priority,
max(responses.response_text) response_text,max(responses.created_date) created_date
into #temp_responses
from lp_uat.responses
INNER JOIN lp_uat.questions on responses.question_key = questions.question_id
where(responses.created_date) in (
select max(responses.created_date) from lp_uat.responses
INNER JOIN lp_uat.questions on responses.question_key = questions.question_id
where question_id in (22,23,24,32,2,3)
group by question_id, person_key, question_key )
and question_id in (22,23,24,32,2,3)
group by question_id, person_key, question_priority


I got gig in end, sloppy seconds, turns out company standard is ANSI strickly applied on anything new.
Comment