We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b89312a + f648e15 commit 7f0851dCopy full SHA for 7f0851d
src/QueryBuilder.php
@@ -721,12 +721,13 @@ protected function getDuplicatesQuery()
721
722
$waFirst = $this->query->getGrammar()->wrapTable($firstAlias);
723
$waSecond = $this->query->getGrammar()->wrapTable($secondAlias);
724
+ $pk = $this->model->getKeyName();
725
726
$query = $this->model
727
->newNestedSetQuery($firstAlias)
728
->toBase()
729
->from($this->query->raw("{$table} as {$waFirst}, {$table} {$waSecond}"))
- ->whereRaw("{$waFirst}.id < {$waSecond}.id")
730
+ ->whereRaw("{$waFirst}.{$pk} < {$waSecond}.{$pk}")
731
->whereNested(function (BaseQueryBuilder $inner) use ($waFirst, $waSecond) {
732
list($lft, $rgt) = $this->wrappedColumns();
733
0 commit comments