Reputation: 87
select rf_id, bname
from books
where rf_id not in (select *
from books
where rf_id='" + tocheck + "');
When executed, it raised the following error. Please help me solve this error.
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS
Upvotes: 0
Views: 28
Reputation: 824
USE:
select rf_id, bname
from books
where rf_id not in (select rf_id
from books
where rf_id='" + tocheck + "')
Upvotes: 0
Reputation: 697
The IN
operator is expecting to compare rf_id
to a single column, so it should be:
where rf_id not in (select rf_id....
However, given that the subquery is being limited by rf_id
anyway, you're better off just changing the query to be:
select rf_id, bname
from books
where rf_id <> '" + tocheck + "'
Upvotes: 1