Biglava
Biglava

Reputation: 43

SQL missing right parenthesis

I have no nerves left.

Here is the code :

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
   )

Results in an error:

0RA-00907: missing right parenthesis

Where is my mistake?

Upvotes: 1

Views: 94

Answers (2)

Elliott Frisch
Elliott Frisch

Reputation: 201447

Well, you can't return two columns in that sub-select (because you want to compare it with the embg field). Also, you don't care about the order of the sub-select. Try something like this instead,

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

Upvotes: 2

BBlake
BBlake

Reputation: 2398

You cannot put ORDER BY inside the parenthesis. Move it up to the end of the previous line after the second WHERE clause.

Upvotes: 4

Related Questions