mysql - Getting total elapsedTime (TIME) in SQL -


please take @ table:

enter image description here

i need count total 'code1' , total 'code2' , total of combine code1 , code2 , total elapsedtime per day (timefiledate). please see output getting:

enter image description here

here's query:

 select          `date`,         `code1`,         `code2`,         `total`            (         select              timefiledate `date`,              (select count(*) tablename transactioncode= 'code1' , timefiledate = `date`)as code1,             (select count(*) tablename transactioncode= 'code2' , timefiledate = `date`)as code2,              (select count(*) tablename transactioncode in ('code1', 'code2') , timefiledate = `date`)as total             #total elapsedtime goes here         bartran      )      `date` between '2013-05-01' , '2013-05-31'     group `date`; 

take note elapsedtime type 'time'. having trouble getting total elapsedtime entire month. please can give me advise. lot!

to return total in seconds, use time_to_sec function - so:

select sum(time_to_sec(elapsedtime)) tablename  transactioncode in ('code1', 'code2') , timefiledate = `date` 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -