From 350b627ce1a247b248845b8b85d2a802c8fb8f74 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Thu, 3 Oct 2024 14:23:40 +0100 Subject: [PATCH] Fix numeric sort 'ambiguous order clause' error --- app/Http/Controllers/Api/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index d1d3878705..d4a103be37 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -395,7 +395,7 @@ class AssetsController extends Controller // This may not work for all databases, but it works for MySQL if ($numeric_sort) { - $assets->orderByRaw($sort_override . ' * 1 ' . $order); + $assets->orderByRaw(DB::getTablePrefix() . 'assets.' . $sort_override . ' * 1 ' . $order); } else { $assets->orderBy($sort_override, $order); }