Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel join

$query = DB::table('posts')
            ->select('posts.*',
                    'subcategories.subcategory_title_en',
                    'subcategories.subcategory_title_bn',
                    'categories.category_title_en',
                    'categories.category_title_bn',
                    'users.*',
                    'postimages.postimage_thumbnail'
                    )
            ->join('subcategories', 'subcategories.subcategory_id', '=', 'posts.subcategory_id')
            ->join('categories', 'categories.category_id', '=', 'subcategories.parent_category_id')
            ->join('users', 'users.id', '=', 'posts.user_id')
            ->join('postimages', 'postimages.post_id', '=', 'posts.post_id')->groupBy('posts.post_id');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #join
ADD COMMENT
Topic
Name
7+2 =