Hi,
If(@username='Ram')BeginSelect Professor,Stu_name,Location,Subject From student where Location in('Hyderabad','Banglore','Chennai')EndElse if(@username='Krishna')BeginSelect Professor,Stu_name,Location,Subject From student where Location in('Pune','Mumbai','Kolkata')EndIi don't need to to Hard code like above..I want logic like , if user logined with ram..i need to set Location,if user logined withkrishna ..i need to set Location...
by using SET we can set only one value at a time for a variable...so i need to set multiple values for Location variable when user logined with that particular username..how can i do it...@Declare @location varchar(20)If(@username='Ram')Beginset @location='Hyderabad','Banglore','Chennai'endElse if(@username='krishna')Beginset @location='Chennai','Pune','Mumbai'EndSelect Professor,Stu_name,Location,Subject From student where Location=@locationSo i want logic like above ....Please Help me