Good morning,
I'd like to use the same condition about quantity I use to discrimate di first table also in the second (instead of NOT EXISTS).
For example with a fixed quantity, i don't need the double discrimination:
Code:
SELECT m.Codice, m.QntFROM Magazzino AS m
WHERE m.[Prossimo_arrivo] Is Null AND
( (m.Qnt < 35 AND m.[Fascia_I] = True) OR
(m.Qnt < 15 AND m.[Fascia_II] = True)
) AND
NOT EXISTS (SELECT 1
FROM Magazzino_Grezzi as mg
WHERE mg.Codice = m.Codice
);
How can I modify my current string?
this is not working:
Code:
SELECT m.Codice, m.QntFROM Magazzino AS m
WHERE m.[Prossimo_arrivo] Is Null AND
( (m.Qnt < 35 AND m.[Fascia_I] = True) OR
(m.Qnt < 15 AND m.[Fascia_II] = True)
) AND
(SELECT 1
FROM Magazzino_Grezzi as mg
WHERE mg.Codice = m.Codice AND
(mg.Qnt < 10)
);