rusking Posted May 19, 2013 Share Posted May 19, 2013 (edited) 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 Edited May 19, 2013 by rusking Quote 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 Quote 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 (edited) fixed the outputs so they should be easier to read now Edited May 19, 2013 by rusking Quote 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. Quote 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 (edited) 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 Edited May 19, 2013 by rusking Quote Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431063 Share on other sites More sharing options...
Solution Barand Posted May 19, 2013 Solution 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 Quote 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 (edited) i think that solved it, thankyou very much Edited May 19, 2013 by rusking Quote Link to comment https://forums.phpfreaks.com/topic/278184-clean-uptable/#findComment-1431065 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.