SQLステートメントにエラーがあります
SELECT temp.* FROM
(SELECT th1.process_id,th2.process_id FROM `thread` as th1,`thread` as th2
where (th1.thread_id=th2.thread_id)and
(th1.process_id!=th2.process_id) and
(th1.analysis_id='".$analysis_id."' ) and
(th2.analysis_id='".$analysis_id."' )) as temp
where ((t emp.p1 NOT IN (select pr.parent_process_id from process as pr
wherer pr.process_id=th2.process_id and (th2.analysis_id='".$analysis_id."' )
and (pr.analysis_id='".$analysis_id."' )))
or (temp.p2 NOT IN
(select pr1.parent_process_id from process as pr1
wherer pr1.process_id=th1.process_id and (th2.analysis_id='".$analysis_id."' )
and (pr1.analysis_id='".$analysis_id."' ))))