MySQL Forums
Forum List  »  Newbie

Re: Query pages printed by percentage of total?
Posted by: Francisco Wong-Li
Date: April 06, 2006 02:59PM

try this

select a.owner, a.printername, a.logDateTime, (sum(a.pagesprinted)/b.hojas) *100 as percet
from printlog a left join
( select logDateTime, printername, sum(pagesprinted) as hojas
from printlog
group by logDateTime,printername
) as b
on b.logDateTime = a.logDateTime
and b.printername = a.printername
where a.printername = 'lpt01'
group by a.owner,a.printername,a.logDateTime

you can use the a.printername and a.logdatetime optional but is necessary when use a range of date


Options: ReplyQuote

Written By
Re: Query pages printed by percentage of total?
April 06, 2006 02:59PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.