2012-05-19 47 views
0

选择我对SQL statmentMySQL的别名为

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."')))) 

回答

4

错误您可以选择使用的wherer代替where一个明显的语法错误。

wherer pr.process_id=th2.process_id and 

应该

where pr.process_id=th2.process_id and 

当MySQL报告类似错误检查手动正确的语法附近使用...,恰好看向那个位置或字符之前它为你的语法错误。

检查对应于你的MySQL服务器版本使用附近的“wherer pr.process_id = tem.p2

正确的语法手册