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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.