Wednesday, 9 November 2016

php - How to combine two queries in laravel?

query1:



 $image= DB::table('products_photos')->groupBy('filename')
->get(['filename', DB::raw('MAX(id) as id')]);


This is my query to retreive single image for all the records stored.




query2:



$verifiedValues= priceInfo::join('productDescription', 
'productDescription.productId', '=', 'productPriceDetails.productId')
->join('productAdditionalInformation',
'productAdditionalInformation.productId', '=',
'productPriceDetails.productId')
->join('products_photos', 'products_photos.productId', '=',
'productAdditionalInformation.productId')

->select('productPriceDetails.SKUID','productDescription.modelName')
**->select($image)**
->where('productPriceDetails.nonliveStatus', '=',
"QCVerified")-

>where('productAdditionalInformation.nonliveStatus','=',"QCVerified")
->where('productDescription.nonliveStatus','=',"QCVerified")
->where('products_photos.nonliveStatus','=',"QCVerified")
->where('productPriceDetails.listingStatus','=',"Inactive")
->get();



This is my query where I have joined multiple tables and need to combine the query1 with query2.



SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters



error on combining both the queries

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...