Crustyfur Posted August 14, 2008 Share Posted August 14, 2008 Hi, Having problem get the nested query working and could use some help. I know that GROUP BY is probably causing the issue but I am not sure how to work around it. SELECT s.subcatid, s.subcategory, c.catid, p.catid, p.subcatid, p.active FROM tt_gear_subcategory s, tt_gear_category c, tt_gear_product p WHERE s.subcatid = p.subcatid AND c.catid = p.catid AND p.catid = '$catid' AND p.active = '1' GROUP BY s.subcatid ORDER BY s.subcategory ASC Second Query: $subcatid = $row["p.subcatid"]; $result2 = $db->sql_query("SELECT catid, subcatid, manfid, active FROM tt_gear_product WHERE catid = '$catid' AND subcatid = '$subcatid' AND active = '1' GROUP BY manfid"); Link to comment https://forums.phpfreaks.com/topic/119619-nested-query-not-functioning-as-intended/ Share on other sites More sharing options...
fenway Posted August 14, 2008 Share Posted August 14, 2008 Not sure what you're trying to do here... seems like you could do it all at once, with a JOIN... but you're returning non-GROUP BY'ed columns in the first query. Link to comment https://forums.phpfreaks.com/topic/119619-nested-query-not-functioning-as-intended/#findComment-616433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.