refs #5066 remake sql without ROW_ORDER
This commit is contained in:
parent
3423ce612c
commit
0661bf8fa9
|
@ -17,14 +17,11 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.sorted = async warehouseFk => {
|
||||
const vehicles = await Self.rawSql(`
|
||||
SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order',
|
||||
v.id,
|
||||
v.warehouseFk,
|
||||
CONCAT(v.numberPlate, ' - ', w.name) as description
|
||||
return Self.rawSql(`
|
||||
SELECT v.id, v.warehouseFk, CONCAT(v.numberPlate, ' - ', w.name) as description
|
||||
FROM vehicle v
|
||||
JOIN warehouse w ON w.id = v.warehouseFk
|
||||
ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC`, [warehouseFk, warehouseFk]);
|
||||
return vehicles;
|
||||
ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC;
|
||||
`, [warehouseFk]);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue