Ad
Row Count From Second Table With More Than One Table Join
I have three table:
TABLE1:
jobposts (id,user_id,qualification_id)
TABLE2:
appliedjobs (id,jobposts_id,message)
TABLE3:
qulificationmasters (id, qualificationame)
jobposts_id from TABLE is foreign key of id of jobposts
I need all records from jobposts with row count of appliedjobs
I tried by this:
$jobposteddetails = DB::table('jobposts')
->rightJoin('qulificationmasters','qulificationmasters.id', '=', 'jobposts.qualification_id')
->leftJoin('appliedjobs','appliedjobs.jobposts_id', '=', 'jobposts.id')
->select('jobposts.*','qulificationmasters.QualificationName', DB::raw('count(appliedjobs.id) as counts'))
->where('jobposts.user_id', '=', $user->id)
->groupBy('appliedjobs.id')
->get();
But gives error like: it wants every column in groupby of jobposts and qulificationmasters and qulificationmasters.id
But gives error like: it wants every column in groupby of jobposts and qulificationmasters and qulificationmasters.id
If I groupby with all columns of jobposts and qulificationmasters then it is working good. But why all the columns gropuby.
Ad
Answer
Go in config folder database.php find mysql array and make strict to false and check again.
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad