Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kiridu
Starting Member
4 Posts |
Posted - 2013-02-27 : 18:21:27
|
Hello I’m getting this error and I can't figure out how to fix it..Error Message: Subquery retured more than 1 value. This is not permitted when the subquery follows =,!=,<, ect... In SQL server I want to display all Record with SKU 1404 and 1354, when they enter '1404' in the filter field. below is my query. thanks in advance. SELECT CASE WHEN SKU = '1404' THEN (SELECT SKU FROM dbo.Table1 AS A WHERE(SKU IN ('1404', '1354'))) ELSE A.SKU END AS SKUFROM dbo.Table1 AS A |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-27 : 18:33:30
|
How do you get the user input? Usually that comes in in a variable like shown below:DECLARE @sku VARCHAR(32) = '1404'; -- this is the user inputSELECT a.SKUFROM dbo.Table1 aWHERE (@sku = '1404' AND a.SKU IN ('1404','1354')) OR @sku = SKU |
|
|
|
|
|