MySQL Forums
Forum List  »  Newbie

Re: Query pages printed by percentage of total?
Posted by: info
Date: April 06, 2006 05:28PM

Yes, yes!! This is very close. Here is my modified version of your query.

SELECT a.owner, a.printerName, a.logDateTime, (
sum( a.pagesPrinted ) / b.hojas) *100 AS percent
FROM printlogs a
SELECT logDateTime, printerName, sum( pagesPrinted ) AS hojas
FROM printlogs
GROUP BY logDateTime, printerName
) AS b ON b.logDateTime = a.logDateTime
AND b.printerName = a.printerName
WHERE a.logDateTime > '2006-03-01'
AND a.logDateTime > '2006-04-01'
AND a.printerName = 'MO161_4_HP4600'
GROUP BY a.owner, a.printerName, a.logDateTime

I still have one issue. The query reports each owner on each day as a seperate row. I would like to have a single row for each owner for the given date range.

Thank you very much for the great example!!


Edited 7 time(s). Last edit at 04/06/2006 05:42PM by info.

Options: ReplyQuote

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

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.