mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
fix ambiguous SQL query
Query did not always return the last run as required due to implementation-defined behaviour of mixing aggregate and non-aggregate columns with group-by
This commit is contained in:
parent
48854239a5
commit
0bacaf2a3e
@ -282,7 +282,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
|||||||
|
|
||||||
} else if(client->scope.type == MonitorScope::ALL) {
|
} else if(client->scope.type == MonitorScope::ALL) {
|
||||||
j.startArray("jobs");
|
j.startArray("jobs");
|
||||||
db->stmt("SELECT name,number,startedAt,completedAt,result FROM builds GROUP BY name ORDER BY number DESC")
|
db->stmt("SELECT name,number,startedAt,completedAt,result FROM builds b JOIN (SELECT name n,MAX(number) l FROM builds GROUP BY n) q ON b.name = q.n AND b.number = q.l")
|
||||||
.fetch<str,uint,time_t,time_t,int>([&](str name,uint number, time_t started, time_t completed, int result){
|
.fetch<str,uint,time_t,time_t,int>([&](str name,uint number, time_t started, time_t completed, int result){
|
||||||
j.StartObject();
|
j.StartObject();
|
||||||
j.set("name", name);
|
j.set("name", name);
|
||||||
|
Loading…
Reference in New Issue
Block a user