Viewed   125 times

I want use WhereIn and Groupby in Same Query to fetch Result.

I've tried this:


But I got this error message:

SQLSTATE[42000]: Syntax error or access violation: 1055 '' isn't in GROUP BY (SQL: select * from loading where id in (14, 15, 16) group by vehicle_no)



Short answer

In configdatabase.php --> "mysql" array

Set 'strict' => false to disable all.

.... or

You can leave 'strict' => true and add modes to "mysql" option in

'mysql' => [
       'strict' => true,
       'modes' => [
            //'ONLY_FULL_GROUP_BY', // Disable this to allow grouping by one column

Detailed answer

You may not need to disable all strict options ... Kindly have a look on this answer about this issue.

Sunday, September 11, 2022

Recommended approach if you put here only methods (not classes):

  1. Create file anywhere you want
  2. In composer.json make sure you add this file to files key inside autoload like this:

    "autoload": {
        // here other autoload things
        "files": ["app/Helpers/AnythingHelper.php"]
  3. Run composerdump-autoload`

For classes obviously you should use standard PSR-4 autoloading

Sunday, October 23, 2022

The "illuminate/html" component is no more supported by Laravel and is not compatible with the 5.2 version.

You can replace it with laravelcollective/html

You have to:

  • remove the reference of "illuminate/html": "^5.0@dev", from composer.json

  • add "laravelcollective/html": "5.1.*" (or the version you want)

  • run composer update to update the dependecies (this will remove your "illuminate/html" component and install the "laravelcollective/html" component

Now you have to replace your HTML service provider with:

 'providers' => [

and the facades:

  'aliases' => [
      'Form' => CollectiveHtmlFormFacade::class,
      'Html' => CollectiveHtmlHtmlFacade::class,
Wednesday, December 21, 2022

In your select you have an aggregate function sum and a set of column name, the error tell you that you have not specified the correct list of column name in group by clause . could be you should add more columns name in group by probably related to the profile_details, opportunity_conditions table

You have also ,(,(, (opportunity.mantaghe), why the () if you need sum you must add sum to all column

sum(, sum(,


otherwise if thes are normal columns you should use the normal sintax without (),,opportunity.mantaghe,

I have tried to rewrite a possible query

FROM `opportunity` 
INNER JOIN `profile_details` ON `opportunity`.`user_id`= `profile_details`.`user_id` 7
INNER JOIN `opportunity_conditions` ON `opportunity`.`id`=`opportunity_conditions`.`opportunity_id` 
GROUP BY`opportunity`.`id`,   `profile_details`.`user_id`,``,  
ORDER BY `opportunity`.`id` DESC

with group by on the essential column name (i hope)

GROUP BY`opportunity`.`id`,   `profile_details`.`user_id`,``,  
Thursday, October 20, 2022

Check in the config/database.php file in the mysql conection that the strict is false:

'strict' => false,

If is true, put in false.

Saturday, November 19, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :