SELECT q.id FROM `ohrm_question` as q, `ohrm_question_question_tag` as qt, `ohrm_question_tag` as t, `ohrm_performance_job_title_questions` as jq WHERE jq.question_id = q.id AND q.is_deleted = 0 AND t.id = qt.tag_id AND q.id = qt.question_id AND (t.tag_name = 'performance questions' OR t.tag_name = concat('specific questions for appraisal ',#appraisalId#)) AND jq.job_title_id = #jobTitleId#