mini\Table\Contracts\MutableTableInterface::distinct()
Method
public
abstract
Signature
public abstract function distinct(): mini\Table\Contracts\TableInterface
Returns
Documentation
Return table with duplicate rows removed
Deduplication is based on the currently visible columns at the point distinct() is called. Further column projections do not change which rows were considered duplicates:
// Distinct on role+name, then project to just role
$table->columns('role', 'name')->distinct()->columns('role');
// May have duplicate roles if different names had same role
// Distinct on just role
$table->columns('role')->distinct();
// Each role appears once
Order relative to limit/offset matters:
$table->distinct()->limit(10); // Deduplicate all, then take 10
$table->limit(10)->distinct(); // Take 10 (with dupes), then deduplicate
Inherited From
mini\Table\Contracts\TableInterface