-
-
Notifications
You must be signed in to change notification settings - Fork 854
Closed
Description
Summary of problem or feature request
I am receiving an exception when the table is loading/refreshing.
General error: 20018 No column name was specified for column 1 of 'count_row_table'. [20018] (severity 16) [select count(*) as aggregate from (select 1 from [files] where [CustomerID] in (3654)) count_row_table]
.
As you see, there is no alias in the subquery generated by the datatable to get the count of rows.
Edit
The bug is not present in 10.4.3. It seems it was introduced in 10.4.4 with the PR #3008
Code snippet of problem
$query = $this->getQuery($request)->withLatestIpaScore();
$datatable = DataTables::of($query);
return $datatable->make(true);
The error goes away if I update my scopeWithLatestIpaScore
function to remove the orderBy.
I have tried orderByDesc also, same result.
I have tried different columns in the orderBy, also tried to prepend the table name.
public function scopeWithLatestIpaScore($query)
{
$query->addSelect(['latest_ipa_score' => FileArmProbabilityIndex::withoutGlobalScopes()->select('Rate')
->whereColumn('FilesArmProbabilityIndex.ExID', 'Files.ID')
->orderBy('ID', 'desc') // Commenting this line make the error go away
->take(1),
]);
}
System details
- Operating System Ubuntu 22.04
- PHP Version 8.1.20
- Laravel Version 10.14.1
- Laravel-Datatables Version 10.6.0
Metadata
Metadata
Assignees
Labels
No labels