Hey guys i have this query:
SELECT Schwellwert
FROM lm_Schwellwert
WHERE (Typ = (SELECT Typ FROM lm_Artikel WHERE `Index` = (SELECT DISTINCT `Index` FROM lm_Warenkorb)))
But when I run it I’m getting this error:
1242 – Subquery returns more than 1 row
I don’t know what is in my query wrong.
Example how lm_Schwellwert looks:
Typ Schwellwert
Computer 78
Example how lm_Artikel looks:
Index Artikelbezeichnung Status Bestand Lieferant Typ
1 HP Elitebook OK 19 HP Computer
Example how lm_Warenkorb looks:
Index
11
1
Where condition could run only aginst one vale (so x=y and so on)
In your case, your subquery
(SELECT Typ FROM lm_Artikel WHEREIndex= (SELECT DISTINCTIndexFROM lm_Warenkorb))is returning more than one row and this cause an error.
Try to modify your query as follow
The
INoperator will help you, since accept a set of values and return true ifTypis equal to one of those