datoshway Posted March 23, 2011 Share Posted March 23, 2011 My group by statement is only returning one result if they are the same data. Need this to display all results even if they are the same. See below what I have. Thanks in advance. $sql = "SELECT * FROM calendar_event GROUP BY month, day, year ORDER BY month, day, year ASC"; $result = mysql_query($sql); $count = mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/231524-group-by-multiple-results/ Share on other sites More sharing options...
The Little Guy Posted March 23, 2011 Share Posted March 23, 2011 "GROUP BY" automatically order the results, so you shouldn't need the "ORDER BY". If I understand your question, maybe this will work: $sql = "SELECT * FROM calendar_event GROUP BY CONCAT(month, day, year)"; Quote Link to comment https://forums.phpfreaks.com/topic/231524-group-by-multiple-results/#findComment-1191431 Share on other sites More sharing options...
datoshway Posted March 23, 2011 Author Share Posted March 23, 2011 That worked! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/231524-group-by-multiple-results/#findComment-1191447 Share on other sites More sharing options...
fenway Posted March 30, 2011 Share Posted March 30, 2011 Yeah, but you can't use *. Quote Link to comment https://forums.phpfreaks.com/topic/231524-group-by-multiple-results/#findComment-1193970 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.