Union viene usato per unire di resultsets che hanno le stesse proprietà. Cioè stesso numero di campi e campi dello stesso tipo.
Per esempio. Se hai : select stringa1, stringa2, numerico1 from tabella1 potrai fare lo UNION con una select dello stesso tipo.
Se fai :
select stringa1, stringa2, numerico1 from tabella1
UNION
select stringa1, numerico1, data1 from tabella2
non funzionerà mentre
select stringa1, stringa2, numerico1 from tabella1
UNION
select stringa5, stringa6, numerico3 from tabella2
funzionerà


Rispondi quotando