quante UNION posso utilizzare?
Perchè al momento devo unire 3 Select, ma potrebbero essere di più
VVoVe:
codice:
SELECT
SUM(Quantita_A) as Q_A
from TB_A
where Prefisso_A IN ('1','2','3','4','5') and
Q_A = '204' and F_A = '1' and S_ = 'a'
UNION
SELECT
SUM(Quantita_B) as Q_B,
SUM(Quantita_C) as Q_C
from TB_A
where Q_A = '204' and F_A = '1' and S_ = 'a'
UNION
SELECT
SUM(Quantita_D) as Q_D
from TB_A
where Prefisso_D IN ('6','7') and
Q_A = '204' and F_A = '1' and S_ = 'a'
Facendo cosi mi restituisce questo errore:
The used SELECT statements have a different number of columns,
Perchè ho aggiunto questa SUM(Quantita_C) as Q_C.
Quindi come faccio a fare la SUM(Quantita_C) as Q_C, devo fare un'altra select?
Cosi per tutte le Sum che verranno?Oppure le posso inserire all'interno di una sola select?
grazie ancora...