使用别名选择MySQL
我在sql语句上有错误使用别名选择MySQL,mysql,Mysql,我在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
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."' ))))
使用
where
而不是where
时出现明显的语法错误
wherer pr.process_id=th2.process_id and
应该是
where pr.process_id=th2.process_id and
当MySQL报告类似于“检查手册”的错误以查找要在…附近使用的正确语法时,请仔细查看该位置或其前面的字符以查找语法错误
查看与您的MySQL服务器版本对应的手册,了解在“where pr.process_id=tem.p2”附近使用的正确语法
使用
where
而不是where
时出现明显的语法错误
wherer pr.process_id=th2.process_id and
应该是
where pr.process_id=th2.process_id and
当MySQL报告类似于“检查手册”的错误以查找要在…附近使用的正确语法时,请仔细查看该位置或其前面的字符以查找语法错误
查看与您的MySQL服务器版本对应的手册,了解在“where pr.process_id=tem.p2”附近使用的正确语法