diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2015-04-14 16:53:41 +0200 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2015-04-14 16:53:41 +0200 |
commit | 7337ac7e744e978ae93a9cd28a08fea728627287 (patch) | |
tree | ce6872884feec738eef5862df0f7135e4277eaf9 /web/nms.gathering.org/port-state.pl | |
parent | e082f5ddb4735ec783a499b6b0066c3459e14618 (diff) |
NMS: ooops. Re-fix SQL that I broke to fix
Diffstat (limited to 'web/nms.gathering.org/port-state.pl')
-rwxr-xr-x | web/nms.gathering.org/port-state.pl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/web/nms.gathering.org/port-state.pl b/web/nms.gathering.org/port-state.pl index 9cc186f..76dd7d8 100755 --- a/web/nms.gathering.org/port-state.pl +++ b/web/nms.gathering.org/port-state.pl @@ -24,7 +24,7 @@ if (defined($cin)) { $when = " time < " . $now . " - '$cin'::interval and time > ". $now . " - ('$cin'::interval + '15m'::interval) "; } -my $query = 'select distinct extract(epoch from date_trunc(\'second\',time)) as time,ifname,ifhighspeed,ifhcinoctets,ifhcoutoctets,sysname from polls natural join switches where ' . $when . ' order by time desc'; +my $query = 'select sysname,extract(epoch from date_trunc(\'second\',time)) as time, ifname,ifhighspeed,ifhcinoctets,ifhcoutoctets from polls natural join switches where time in (select max(time) from polls where ' . $when . ' group by switch,ifname);'; my $q = $dbh->prepare($query); $q->execute(); |