mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
tune order by to sort nearest active dv first
This commit is contained in:
@@ -59,7 +59,14 @@ class Dienstverhaeltnis_model extends DB_Model
|
||||
}
|
||||
|
||||
$qry .="
|
||||
ORDER BY COALESCE(dv.bis, '2999-12-31'::date) DESC, dv.von DESC
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN (COALESCE(dv.bis, '2999-12-31'::date) - NOW()::date) < 0 THEN NULL
|
||||
ELSE
|
||||
(COALESCE(dv.bis, '2999-12-31'::date) - NOW()::date)
|
||||
END ASC NULLS LAST,
|
||||
COALESCE(dv.bis, '2999-12-31'::date) DESC,
|
||||
dv.von DESC
|
||||
";
|
||||
|
||||
return $this->execQuery($qry, $data);
|
||||
|
||||
Reference in New Issue
Block a user