I'm getting the following error when trying to run a very simple query on a SQL Server database from a PHP script...
SQLSTATE[21000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. (SQL: select * from [NAVItems] where [Brand] = DELINTE)
As you can see, there is no subquery. I'm just trying to pull a list of product records of a specific brand. The strange thing is, it only happens with this one brand, DELINTE. For example...
select * from [NAVItems] where [Brand] = 'FALKEN';
...works fine.
Also, the query works for DELINTE if I change the selection to specific fields instead of *. For example...
select [Style] from [NAVItems] where [Brand] = 'DELINTE';
...also works fine.
But...
select * from [NAVItems] where [Brand] = 'DELINTE';
...keeps throwing the above error.
I'm so confused. Any idea why it might be doing this? Any and all help is greatly appreciated.
EDIT: I found the problem. Yes there was a subquery in the view, and there were some duplicate records in a related table, causing the error. Thanks for pointing me in the right direction!