Harinath Devineni Harinath Devineni - 9 months ago 43
SQL Question

Subquery returned more than 1 value. This is not permitted when the subquery using comparision operators

I have a 2 drop down where i need to populate 2nd drop down based on 1st Drop down,I have added 'all' option to 1st drop down when user selected 'all' need to populate the 2nd drop down The query i have used is

SELECT DISTINCT [Year] from dbo.[tbl_A]
WHERE [TyreSize] IN
(CASE 'All'
WHEN 'All' Then (SELECT DISTINCT [Tyresize] FROM dbo.[tbl_A])
WHEN '27.00 R 49' Then (SELECT DISTINCT Tyresize FROM dbo.[tbl_A]
WHERE [TyreSize] IN ('27.00 R 49'))


Use OR instead of CASE WHEN

SELECT DISTINCT [Year] from dbo.[tbl_A] 
    @All = 'All' OR -- @All is your parameter
    [TyreSize] IN ('27.00 R 49')