php - How Do I JOIN a third Table called all_recipes using recipe_id KEY -


select cou.recipe_id, ifnull(fou.found, 0) found, cou.count  ( select recipe_id, count(recipe_id) count          recipe_ingredients          group recipe_id) cou left outer join ( select r.recipe_id, count(r.key_ingredient) found         users_ingredients u         join recipe_ingredients r on r.key_ingredient = u.key_ingredient         group r.recipe_id) fou on fou.recipe_id = cou.recipe_id 

i need join 3 tables - well, 4 in end. can please show me how can , explain how keep joining when required later. have 4 or more tables. many

credit @arulkumar above

i don't understand sql but, join table need this.

select recipe.id, all_recipes.id  recipe  left join all_recipes on recipe.id = all_recipes.id  

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -