Miko Posted July 1, 2009 Share Posted July 1, 2009 Hello, I have here this query: SELECT COUNT(date) AS aantal FROM DATA WHERE depot = '$pk' AND nr BETWEEN '$pkNV' AND '$pkNB' GROUP BY date DESC LIMIT 10 I can here then echo the "aantal" so I get the amount of results. But I would like to echo the field date also, how can I do that? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/164370-solved-echo-a-select-count/ Share on other sites More sharing options...
MatthewJ Posted July 1, 2009 Share Posted July 1, 2009 SELECT COUNT(date) AS aantal, `date` AS display FROM DATA WHERE depot = '$pk' AND nr BETWEEN '$pkNV' AND '$pkNB' GROUP BY date DESC LIMIT 10 Quote Link to comment https://forums.phpfreaks.com/topic/164370-solved-echo-a-select-count/#findComment-867082 Share on other sites More sharing options...
Miko Posted July 1, 2009 Author Share Posted July 1, 2009 Hi, that didn't work Quote Link to comment https://forums.phpfreaks.com/topic/164370-solved-echo-a-select-count/#findComment-867086 Share on other sites More sharing options...
MatthewJ Posted July 1, 2009 Share Posted July 1, 2009 The date is held in display ($row['display'])... I tested it locally and it worked fine, what do you mean by "that didn't work"? Quote Link to comment https://forums.phpfreaks.com/topic/164370-solved-echo-a-select-count/#findComment-867089 Share on other sites More sharing options...
Miko Posted July 1, 2009 Author Share Posted July 1, 2009 ha it works, didn't saw the AS display at the first time thanks! Quote Link to comment https://forums.phpfreaks.com/topic/164370-solved-echo-a-select-count/#findComment-867092 Share on other sites More sharing options...
MatthewJ Posted July 1, 2009 Share Posted July 1, 2009 Glad it worked Quote Link to comment https://forums.phpfreaks.com/topic/164370-solved-echo-a-select-count/#findComment-867094 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.