Reputation: 2187
I have a table with products. One column contains the expiry date of these products. If they don't have such an expiry date it is written '-' . I want to get the id's of the products which are expired and i have the following problem:
The statement:
SELECT id from product where
(select expiry from product where expiry not in ('-')) < GETDATE()
The error:
Subquery returned more than 1 value. This is not permitted when the subquery
follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
How can I get the products that meet the condition written above?
Upvotes: 1
Views: 75
Reputation: 23972
You can't compare one value to many in that way. I suspect what you really want is:
SELECT id
FROM product
WHERE expiry < GETDATE()
AND expiry <> '-'
Upvotes: 4