cjackson111 Posted May 5, 2013 Share Posted May 5, 2013 Hello. I am pulling data, joining two MySQL tables (using php). When I use the following part in my select statement all rows are returned (which I want) even if it does not have a value for 'r_star' SELECT..... challnge.r_star ..... FROM.... But when I use the following, only rows are returned that have values for 'r_star' SELECT..... AVG(challnge.r_star) ..... FROM.... I want to find the average for the field r_star. Any ideas what I may be doing worng? Thanks! Link to comment https://forums.phpfreaks.com/topic/277675-phpmysql-query-not-showing-all-rows/ Share on other sites More sharing options...
Jessica Posted May 5, 2013 Share Posted May 5, 2013 How can it use them in the average if they don't have a value? $a = 1; $b = 2; What's the average of $a, $b and $c? Link to comment https://forums.phpfreaks.com/topic/277675-phpmysql-query-not-showing-all-rows/#findComment-1428467 Share on other sites More sharing options...
cjackson111 Posted May 5, 2013 Author Share Posted May 5, 2013 It should return the average value from the database fields Link to comment https://forums.phpfreaks.com/topic/277675-phpmysql-query-not-showing-all-rows/#findComment-1428469 Share on other sites More sharing options...
Jessica Posted May 5, 2013 Share Posted May 5, 2013 Cool story bro. Link to comment https://forums.phpfreaks.com/topic/277675-phpmysql-query-not-showing-all-rows/#findComment-1428470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.