Reputation: 139
I have this query... and I would like to make a distinct only in (tbl_holdings)
This is my query
$holdings = DB::table('tbl_perimetros')
->distinct()
->join('tbl_holdings', 'tbl_holdings.id', '=', 'tbl_perimetros.holdings_id')
->get();
Upvotes: 0
Views: 845
Reputation: 13394
Use groupBy
instead of distinct
:
$holdings = DB::table('tbl_perimetros')
->groupBy('tbl_perimetros.holdings_id')
->get();
Add modes
to the config/database.php
'mysql' => [
...
'modes' => [
'STRICT_ALL_TABLES',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_ZERO_DATE',
'NO_ZERO_IN_DATE',
'NO_AUTO_CREATE_USER',
],
],
Upvotes: 1