scarhand Posted March 22, 2009 Share Posted March 22, 2009 i need to add the following 2 queries: $query = mysql_query("SELECT COUNT(*) FROM `peers` WHERE `hash` = RTRIM('$hash) AND `left` = 0 AND `expire_time` > NOW()"); $query = mysql_query("SELECT COUNT(*) FROM `peers` WHERE `hash` = RTRIM('$hash) AND `left` > 0 AND `expire_time` > NOW()"); to this query: $sql = mysql_query("select t.id, t.uploader_id, s.memberName, t.category_id, c.name, t.hash, t.title, t.file_name, t.file_size, t.rating, t.date_uploaded from thefiles as t, smf_members as s, categories as c where t.uploader_id = s.ID_MEMBER and t.category_id = c.id order by t.id desc limit 50") or die(mysql_error()); i created that query myself, but i have no idea how to add the counts to it so its all in 1 nice query. can a guru help? Quote Link to comment https://forums.phpfreaks.com/topic/150528-solved-adding-2-counts-to-an-existing-query/ Share on other sites More sharing options...
fenway Posted March 27, 2009 Share Posted March 27, 2009 what's wrong with subqueries? Quote Link to comment https://forums.phpfreaks.com/topic/150528-solved-adding-2-counts-to-an-existing-query/#findComment-795274 Share on other sites More sharing options...
scarhand Posted March 29, 2009 Author Share Posted March 29, 2009 nothing. i ended up adding the sub queries right into the original query. Quote Link to comment https://forums.phpfreaks.com/topic/150528-solved-adding-2-counts-to-an-existing-query/#findComment-796110 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.