MySQL Forums
Forum List  »  Newbie

Re: Aged ticket report
Posted by: Peter Brawley
Date: November 17, 2014 11:28PM

Assuming a table with a ticket date column named td, something like ...

select 
  sum(if( datediff(curdate(),td)<=1, 1, 0 )) as '1 day',
  sum(if( datediff(curdate(),td)>1 and datediff(curdate(), td)<=5, 1, 0 )) as '2-5 days',
  sum(if( datediff(curdate(),td)>5 and datediff(curdate(), td)<=10, 1, 0 )) as '6-10 days',
  ...etc...
from tbl;

Options: ReplyQuote


Subject
Written By
Posted
November 17, 2014 05:23PM
Re: Aged ticket report
November 17, 2014 11: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.