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 => {
|
Self.sorted = async warehouseFk => {
|
||||||
const vehicles = await Self.rawSql(`
|
return Self.rawSql(`
|
||||||
SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order',
|
SELECT v.id, v.warehouseFk, CONCAT(v.numberPlate, ' - ', w.name) as description
|
||||||
v.id,
|
|
||||||
v.warehouseFk,
|
|
||||||
CONCAT(v.numberPlate, ' - ', w.name) as description
|
|
||||||
FROM vehicle v
|
FROM vehicle v
|
||||||
JOIN warehouse w ON w.id = v.warehouseFk
|
JOIN warehouse w ON w.id = v.warehouseFk
|
||||||
ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC`, [warehouseFk, warehouseFk]);
|
ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC;
|
||||||
return vehicles;
|
`, [warehouseFk]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue