SQL Server Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >=
Try this:
SELECT od.Sku, od.mf_item_number, od.Qty, od.Price, s.SupplierId, s.SupplierName, s.DropShipFees, si.Price as costFROM OrderDetails od INNER JOIN Supplier s on s.SupplierId = od.Mfr_ID INNER JOIN Group_Master gm on gm.Sku = od.Sku INNER JOIN Supplier_Item si on si.SKU = od.Sku and si.SupplierId = s.SupplierIDWHERE od.invoiceid = '339740'
This will return multiple rows that are identical except for the cost
column. Look at the different cost values that are returned and figure out what is causing the different values. Then ask somebody which cost value they want, and add the criteria to the query that will select that cost.
Check to see if there are any triggers on the table you are trying to execute queries against. They can sometimes throw this error as they are trying to run the update/select/insert trigger that is on the table.
You can modify your query to disable then enable the trigger if the trigger DOES NOT need to be executed for whatever query you are trying to run.
ALTER TABLE your_table DISABLE TRIGGER [the_trigger_name]UPDATE your_tableSET Gender = 'Female'WHERE (Gender = 'Male')ALTER TABLE your_table ENABLE TRIGGER [the_trigger_name]
SELECT COLUMN FROM TABLE WHERE columns_name IN ( SELECT COLUMN FROM TABLE WHERE columns_name = 'value');
note: when we are using sub-query we must focus on these points:
- if our sub query returns 1 value in this case we need to use (=,!=,<>,<,>....)
- else (more than one value), in this case we need to use (in, any, all, some )