1

我无法执行此查询

ORA-00933: SQL 命令未正确结束
00933. 00000 - “SQL 命令未正确结束”

select count(user_id) 
from t_user 
where user_id = 2699478, object_id = 1329 
  and user_id not in
      (SELECT owner_user_id FROM t_obj where actual_id = 17447);  
4

4 回答 4

5

您必须用适当的条件运算符替换,两个条件之间的逗号user_id=2699478 ,object_id=1329,并使用括号以您想要的方式表达它们,如下所示:

SELECT COUNT(user_id) 
FROM t_user 
WHERE user_id = 2699478 
  AND object_id = 1329 
  AND user_id NOT IN
    (
        SELECT owner_user_id 
        FROM t_obj 
        WHERE actual_id = 17447
    ) 
于 2012-06-20T15:50:54.157 回答
4

尝试将逗号替换为AND

select count(user_id) from t_user where user_id=2699478 AND object_id=1329 and user_id not in
  (SELECT owner_user_id FROM t_obj where actual_id = 17447);
于 2012-06-20T15:50:38.760 回答
3

将逗号替换为and

select count(user_id)
from t_user
where user_id=2699478
  and object_id=1329
  and user_id not in (SELECT owner_user_id FROM t_obj where actual_id = 17447);
于 2012-06-20T15:50:48.600 回答
1

您需要用“AND”替换逗号:

SELECT count(user_id) FROM t_user WHERE user_id=2699478 AND object_id=1329 AND user_id NOT IN
      (SELECT owner_user_id FROM t_obj WHERE actual_id = 17447);  
于 2012-06-20T15:54:46.963 回答