mardi 28 novembre 2017

Laravel query building with join and groupBy

I tried building this query with Laravel

$products = DB::table('products as p')
            ->join('manufacturers', 'manufacturers.id', '=', 'p.productManufacturerID')
            ->join(DB::raw('SELECT  *
                 FROM `product_options`
                 GROUP BY productID'),function($join){
                        $join->on('product_options.productID', '=', 'p.id');
            })
            ->select('p.productSKU', 'p.productName','p.productPrice',
                'p.productSize','p.productDescription','p.productQuantity',
                'manufacturers.brandName')
            ->where('p.productCategoryID', $category->id)
            ->get()->toArray();

and getting error http://ift.tt/2ibBAXq what is the issue there



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zLI5rJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire