Jump to content

Nested query not functioning as intended


Crustyfur

Recommended Posts

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");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.