iif with sum function please ! urgent!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have i table in access db like this
----------------------------------------
fldid | fldio | fldqty | fldKOD | ......
----------------------------------------
long | bool | long | string | .....
----------------------------------------
so i want to sum fldqty like some thing below please help !

SELECT fldKOD, IIf(fldIO=1,Sum(fldQty),0) AS
GIDEN,IIf(fldIO=0,Sum(fldQty),0) AS GELEN
FROM SIPARIS
GROUP BY fldKOD

but acces gives an error says this message
you run a query that not having a part of sum 'IIf(fldIO=1,Sum(fldQty),0)'
error(error3122)
 
Try this

SELECT fldKOD,
Sum(IIf(fldIO,[fldQty],0)) AS GIDEN,
Sum(IIf(NOT fldIO,[fldQty],0)) AS GELEN
FROM SIPARIS
GROUP BY fldKOD


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
Back
Top