Let’s suppose you are executing the given queries in SQL Server.
Select * from Employee where DepartmentID= (select id from Department)
But getting the below error.
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
In above SQL statement, This subquery returns multiple values, but it can't assign multiple values to DepartmentId in a single record.
Solution of the Error:
To avoid this error, Some ideas are following :
1) Add a top 1 and order by to the subquery.
2) Make sure that Subquery returns only single record.
Solution of above
Select * from Employee where DepartmentID = (select top 1 id from Department order by id)
If you want to sell your readymade software to the genuine clients or businessman, list your software with details and demo links.
Clients will find it using our advanced search filter and will contact you directly.
No any charge for the product lsiting.