sum of the same field,many times,with different criteria,in the same query

vendredi 20 mars 2015

Hi there,



I have a table [maintable] that holds print records, with the following fields : id,userlogon,printername,pagecount,color(yes/no),duplex(yes/no),timestamp and papersize.



I want to create a query that will show the following:



Sum of pagecount where papersize like 'a4' and between 2 dates but FOR EACH USERLOGON.The dates will take them from 2 fields in a form so i will use this "WHERE (((maintable.Timestamp)>=[forms]![reportsform]![frmdate] And (maintable.Timestamp)<DateAdd("d",1,[Forms]![reportsform]![todate])))" and some more..



So i want the query to show,first the userlogon then a field to show sum of a4 then a4 color prints etc..(remember,i want the between 2 dates criteria to be global,to the whole query)



here are all of the criteria fields i want:



1) - papersize=A4

2) - papersize=A4 and Color=True

3) - papersize=A4 and Color=False

4) - papersize=A4 and Duplex=True

5) - papersize=A4 and Duplex=False

6) - papersize=A4 and Color=True and Duplex=True

7) - papersize=A4 and Color=True and Duplex=False

8) - papersize=A4 and Color=False and Duplex=True

9) - papersize=A4 and Color=False and Duplex=False



I wish i could do it by myself.I always try to find stuff on the internet so i don't have to ask others.But this one too complicated for me.



Thanks in advance

sum of the same field,many times,with different criteria,in the same query

0 commentaires:

Enregistrer un commentaire

Labels