Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL缺少右括号_Sql - Fatal编程技术网

SQL缺少右括号

SQL缺少右括号,sql,Sql,我没有神经了 代码如下: select o.embg from objekti o where o.embg not in ( select s.embg, t.time from objekti o, sopstvenici s, tipovi t where o.embg = s.embg and o.tid = t.tid and t.time = 'Куќа' order by o.embg ) 导致错误: 0RA-00907

我没有神经了

代码如下:

select o.embg from objekti o
   where o.embg not in (
      select s.embg, t.time
      from objekti o, sopstvenici s, tipovi t
      where o.embg = s.embg and o.tid = t.tid and t.time = 'Куќа'
      order by o.embg
   )
导致错误:

0RA-00907:缺少右括号


我的错误在哪里?

你不能把
按顺序
放在括号内。将其上移到第二个
WHERE
子句后的上一行末尾。

不能将
ORDER BY
放在括号内。将其上移到第二个
WHERE
子句后的上一行末尾。

那么,您不能在该子选择中返回两列(因为您想将其与
embg
字段进行比较)。此外,您不关心子选择的顺序。试试这样吧

select o.embg from objekti o where o.embg not in (select s.embg from
  sopstvenici s,tipovi t where o.embg=s.embg and 
  o.tid=t.tid and t.time='Куќа') 
order by o.embg

嗯,您不能在该子选择中返回两列(因为您希望将其与
embg
字段进行比较)。此外,您不关心子选择的顺序。试试这样吧

select o.embg from objekti o where o.embg not in (select s.embg from
  sopstvenici s,tipovi t where o.embg=s.embg and 
  o.tid=t.tid and t.time='Куќа') 
order by o.embg

此外,“not in”语句不能与返回多个字段的“select”语句一起使用,对吗。我在子查询中错过了t.time。此外,“not in”语句不能与返回多个字段的“select”语句一起使用,对吗?也是。我错过了子查询中的t.time。