28/10/2011, 10:18
|
| | Fecha de Ingreso: junio-2011
Mensajes: 329
Antigüedad: 13 años, 4 meses Puntos: 2 | |
error query union alguien sabe por que me marca este error:
All the queries in a query expression containing a UNION operator must have the same number of expressions in their select lists.
select S.SID, Sum(Contado) AS Contado, Sum(Credito) as Credito
from (
Select
[SALES2].SID, sum([SALES2].Venta)*1.11 AS Contado,
0 AS Credito
FROM [SALES2]
WHERE
[SALES2].venta<>0
And [SALES2].idate ='10/26/2011'
And [SALES2].type In (2,3)
GROUP BY [SALES2].idate, [SALES2].SID
union
Select
0 AS Contado,
sum([SALES2].Venta)*1.11 AS Credito
FROM [SALES2]
WHERE [SALES2].sid IN (1,2,4,5,8,10,12,16,18,19,20,21)
And [SALES2].venta<>0
And [SALES2].idate ='10/26/2011'
And [SALES2].type In (0,1)
GROUP BY [SALES2].idate, [SALES2].SID
) as S
group by SID
saludos....y gracias por su respuesta |