Sql ---select sum?
Hola, desearia ayuda, no se como dar la instruccion para el caso siguiente:
Suma los datos del campo TOTAL de la tabla FACTURA donde el STATUS sea ACTIVA y el VENDEDOR sea 11
Tengo parte del codigo, por el momento lo tengo asi:
Select sum(total) from factura where status in ('activa')
Suma los datos del campo TOTAL de la tabla FACTURA donde el STATUS sea ACTIVA y el VENDEDOR sea 11
Tengo parte del codigo, por el momento lo tengo asi:
Select sum(total) from factura where status in ('activa')
OK,
Variable1="activa
Varible="11" 'Vendedor
Select STATUS, VENDEDOR,Sum(Total) as MontoGlobal FROM Factura WHERE STATUS='"+Variable1 +"'"+" and val(VENDEDOR)=&Variable2 & " GROUP BY STATUS,VENDEDOR"
ojo tener cuidado si el campo Vendedor es de tipo numerico ya no es necesario agrgarle VAL
copia esta linea selec y funcionará
suerte
SALU2
Variable1="activa
Varible="11" 'Vendedor
Select STATUS, VENDEDOR,Sum(Total) as MontoGlobal FROM Factura WHERE STATUS='"+Variable1 +"'"+" and val(VENDEDOR)=&Variable2 & " GROUP BY STATUS,VENDEDOR"
ojo tener cuidado si el campo Vendedor es de tipo numerico ya no es necesario agrgarle VAL
copia esta linea selec y funcionará
suerte
SALU2
