rusking Posted May 19, 2013 Share Posted May 19, 2013 SELECT TYPE,date , (Amount) FROM DEBITS where TYPE='Cell Phone' HAVING Date BETWEEN '1999-05-20 00:00:00' AND '2013-05-21 00:00:00' Gives me : Im trying to add all the 'Vaule' displayed. IF i SUM like this SELECT TYPE,date , SUM(Amount) FROM DEBITS where TYPE='Cell Phone' HAVING Date BETWEEN '1999-05-20 00:00:00' AND '2013-05-21 00:00:00' I get: This seems correct but if i chage the dates and sum: SELECT TYPE,date , SUM(Amount) FROM DEBITS where TYPE='Cell Phone' HAVING Date BETWEEN '2012-05-20 00:00:00' AND '2013-05-21 00:00:00' I return : I am new to MySQLi and have been learning it the past 30 hours. Ultimately if i could add only the 'Vaule' of the proucted array i should be ok but i keep breaking it Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/ Share on other sites More sharing options...
Barand Posted May 19, 2013 Share Posted May 19, 2013 At least make some attempt to make the outputs readable Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431057 Share on other sites More sharing options...
rusking Posted May 19, 2013 Author Share Posted May 19, 2013 fixed the outputs so they should be easier to read now Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431060 Share on other sites More sharing options...
Barand Posted May 19, 2013 Share Posted May 19, 2013 What output are you trying to get? You haven't said what your problem is, all you've done is tell us what you have tried. Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431062 Share on other sites More sharing options...
rusking Posted May 19, 2013 Author Share Posted May 19, 2013 It currently adds the amounts column if i use SUM. Im wanting it to when it narow the date, only add the amounts ('vaule') shown. The third returned image shows its still addin all teh amounts instead of teh selected dates. The first returned image shows every entry for reference Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431063 Share on other sites More sharing options...
Barand Posted May 19, 2013 Share Posted May 19, 2013 try SELECT TYPE, SUM(Amount) as total FROM DEBITS WHERE TYPE='Cell Phone' AND DATE(Date) BETWEEN '2012-05-20' AND '2013-05-21' GROUP BY TYPE Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431064 Share on other sites More sharing options...
rusking Posted May 19, 2013 Author Share Posted May 19, 2013 i think that solved it, thankyou very much Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.