lundi 25 juillet 2016

Join in 3 tables

I have 3 tables food,restaurant and categories.
I want to make join between these.I have a query to join food and categories as:

> $Category = DB::table('food')->select('food.Food_id','food.FoodName','food.FoodImage','food.FoodType','categories.CategoryName')->join('categories','categories.Category_id','=','food.Category_id')->where('categories.CategoryName', '=','Breakfast')->get();

I want to join restaurant with this.How I can do that? My tables are:

Food:

  • Food_id(PK)

    FoodName

    Category_id(FK)

And Category table is:

  • Category_id(PK)

    CategoryName

And restaurant table is:

  • Res_id

    Res_Name

    Address_loc

    Food_id(FK)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire