我有laravel查询
$types=Types::selectRaw('COUNT(property_types.id) as total, property_types.types, property_types.id')
->join('properties', 'property_types.id', '=',
'properties.property_type')
->where('property_purpose', '"Sale"')
->groupBy('property_types.id','property_types.id','property_types.types')
->get();
和我没有任何结果
Collection {#383 ▼
#items:[]
我改变 - >获得()通过 - > toSql();我有laravel查询
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` = ?
group by `property_types`.`id`, `property_types`.`id`, `property_types`.`types`
改变吗?通过变量“卖”拷贝并粘贴phpMyAdmin的,我得到了我想要的结果
我不知道错在Laravel雄辩什么!
对于我这种工作
$类型=类型:: selectRaw( 'COUNT(property_types.id)为总,property_types.types,property_types.id')
->join('properties', 'property_types.id', '=',
'properties.property_type')
->where('property_purpose', 'Sale')
->groupBy('property_types.id','property_types.id','property_types.types')
->get();