I wan’t to update a column if a certain userid was found in a log for violations.
UPDATE
USER_CHECK_LOGIN
SET
CHECKLOGIN = 2
WHERE
USER_CHECK_LOGIN.USER_ID = (SELECT NAME from XTREME.gamelogs.dbo.LOG_USING_DEPOT201211 WHERE GATENUM=150);
What this query does is, if a userid is found in the logs where the gatenum is 150, all users will be banned.
But I seem to get an error.
Msg 512, Level 16, State 1, Line 2
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
Instead of
=, useIN()since the subquery is expected to return multiple rows. Using=in comparison against a subquery return value assumes only one row with one column is returned.