Tengo la siguiente consulta
select count(property_types.id) as total, property_types.types,
property_types.id
from `property_types` inner join `properties` on
`property_types`.`id` = `properties`.`property_type` where
`property_purpose` = "Sale"
group by `property_types`.`id
esta consulta me genera el siguiente resultado
Necesito esta misma consulta en eloquent de laravel
Intente de la siguiente manera
$types=DB::select(DB::raw('select count(property_types.id) as total,
property_types.types, property_types.id from
`property_types` inner join `properties` on
`property_types`.`id` =
`properties`.`property_type` where
`property_purpose` = "Sale" group by
`property_types`.`id`'));
pero me da este error
SQLSTATE[42000]: Syntax error or access violation: 1055 'admin_ezcabo.property_types.types' isn't in GROUP BY (SQL: select count(property_types.id) as total, property_types.types, property_types.id from
property_types
inner joinproperties
onproperty_types
.id
=properties
.property_type
whereproperty_purpose
= "Sale" group byproperty_types
.id
)
Lo que me tiene dudando es que copio y pego lo Indicado en NEGRITA del erro en el gestor de Base de dato y me da bien el resultado