nec9716 Posted May 22, 2008 Share Posted May 22, 2008 ok here what is my issue: $litres= 'SELECT avg (litre) FROM gb1 '; I want to be able to have more avg from gb1? thank you and have a great day Quote Link to comment https://forums.phpfreaks.com/topic/106765-avg-how-can-i-have-more-then-1-field/ Share on other sites More sharing options...
beboo002 Posted May 22, 2008 Share Posted May 22, 2008 $litres= 'SELECT avg (litre) as liters,avg(xyz) as xyz1 FROM gb1 '; echo $row[liters]; echo $row[xyz1]; If this is not ur requirement please describe ur question what you need? Quote Link to comment https://forums.phpfreaks.com/topic/106765-avg-how-can-i-have-more-then-1-field/#findComment-547299 Share on other sites More sharing options...
nec9716 Posted May 22, 2008 Author Share Posted May 22, 2008 ok I get that working now if I want to have avg and total in the same command how can I set that or do I have to make 2 separate request? presently I have something like that: $sqlt = 'SELECT avg (litre) as liters , (mpg) as mpg FROM gb1 '; Quote Link to comment https://forums.phpfreaks.com/topic/106765-avg-how-can-i-have-more-then-1-field/#findComment-547321 Share on other sites More sharing options...
wildteen88 Posted May 22, 2008 Share Posted May 22, 2008 You can use SUM(liters , mpg) as total maybe Quote Link to comment https://forums.phpfreaks.com/topic/106765-avg-how-can-i-have-more-then-1-field/#findComment-547431 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.