0

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

1 回答 1

4

使用wherer而不是出现明显的语法错误where

wherer pr.process_id=th2.process_id and

应该

where pr.process_id=th2.process_id and

当 MySQL 报告类似于Check the manual for the correct syntax to use near...的错误时,请准确查看该位置或紧邻其之前的字符是否存在语法错误。

检查与您的 MySQL 服务器版本相对应的手册,以在 'wherer pr.process_id=tem.p2 附近使用正确的语法

于 2012-05-19T11:24:44.217 回答