I have tried for hours now trying to figure out how to do this and I'm sure its impossible, I have tried the following queries and still searching for the solution.
I need to display the subcategories, subcat_title table row based on the condition the table row cat_id is equal to the cat_id row of the categories table. Its working but not how I need it to as its repeating the table row cat_title from the categories table. I'm trying to get this query to work so I can create a Mega Menu for my site.
Any help would be very appreciated.
$sql = "SELECT * FROM categories c, subcategories s WHERE c.cat_id = s.cat_id ORDER BY ABS( `cat_title` )";
$sql = "SELECT COUNT(*) as repetitions, c.cat_id, c.cat_title, s.subcat_id, s.subcat_title, s.cat_id FROM subcategories AS s INNER JOIN categories AS c ON c.cat_id=s.cat_id GROUP BY s.cat_id HAVING repetitions > 1";
$sql = "SELECT c.cat_id, c.cat_title, s.subcat_id, s.subcat_title, s.cat_id FROM subcategories AS s LEFT OUTER JOIN categories AS c ON c.cat_id = s.cat_id ORDER BY c.cat_title";