Skip to content
Advertisement

An expression of non-boolean type specified in a context where a condition is expected, near ‘)’. error in SQL

I need to find matching id from two tables (client & activity), and update the data from (clientid) column in table client to the same column (id) the other table (activity):

update activity
set a.clientid = r.clientid 
where (select r.clientid, r.id 
       from request r 
       where exists(select a.activityid from activity a where (a.id = r.id))

It throws an exception

An expression of non-boolean type specified in a context where a condition is expected, near ‘)’

Advertisement

Answer

I think you want an update with join. In SQL Server, this looks like:

update a
    set clientid = r.clientid 
from activity a join
     request r
     on a.id = r.id;
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement