我试图做这样的查询: DELETE FROM term_hierarchy AS th WHERE th.parent = 1015 AND th.tid IN ( SELECT DISTINCT(th1.tid) FROM term_hierarchy AS th1 INNER JOIN term_hierarchy AS th2 ON (th1.tid = th2.tid AND th2.parent != 1015) WHERE th1.parent = 1015 ); 正如你可能知道,如果同一个tid有其他父母,我想删除父母关系到1015。 但是,这给我一个语法错误: You have an error in your SQL syntax; check the manual that corresponds to your […]
我试图用子查询和一个INexpression式多次写查询语句。 但我从来没有成功。 我总是得到exception,“附近关键字”IN“的语法错误”,查询语句是这样构build的, SELECT t0.ID, t0.NAME FROM EMPLOYEE t0 WHERE IN (SELECT ? FROM PROJECT t2, EMPLOYEE t1 WHERE ((t2.NAME = ?) AND (t1.ID = t2.project))) “IN”输之前我知道这个词。 你有没有写过这样的查询? 任何build议?