dylan666 wrote:
> update Table1
> set Visibility=1
> where ConsumerID in (select * from
> Table1 join Table2
> on Table1.ConsumerID = Table2.id
> where Table1.visibility = 0 and Table2.visibility = 1)
>
> Unfortunately I get this error:
> only a single result allowed for a SELECT that is part of an expression

The subquery returns all columns, but "ConsumerID IN ..." expectes only
one column.  (Which one should be compared?)

Change the subquery to return only the column you want to use:

  update Table1
  set Visibility=1
  where ConsumerID in (select Table1.ConsumerID from
                       Table1 join Table2
                       on Table1.ConsumerID = Table2.id
                       where Table1.visibility = 0 and Table2.visibility = 1)

But the IN makes the join superfluous:

  UPDATE Table1
  SET Visibility = 1
  WHERE ConsumerID IN (SELECT ID
                       FROM Table2
                       WHERE Visibility = 1)
    AND Visibility = 0


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to