Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
declare @Price nvarchar(200)
set @Price = (select MIN(price) [Min], MAX(price) [Max] from
(select Day_Price as price from t_CoachDetails
union
select Round_Price as price from t_CoachDetails
union
select Destination_Price as price from t_CoachDetails)as pric)
select @Price



error given
--------------
SQL
Msg 116, Level 16, State 1, Line 8
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Posted

1 solution

SQL
-- set one expression in your sub query,
declare @Price nvarchar(200)
set @Price = (select MIN(price) [Min] from
(select Day_Price as price from t_CoachDetails
union
select Round_Price as price from t_CoachDetails
union
select Destination_Price as price from t_CoachDetails)as pric)
select @Price
 
Share this answer
 
Comments
krishna97 24-Apr-15 7:11am    
min and max value can both
pratap420 28-Apr-15 6:26am    
How come you assign two values in a single variable in a single shot? If you want you can use multiple variables to assign multiple values

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900