From 5d45000dd490d7618a64c295e9e541934c7fa9b7 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 22 Dec 2022 11:53:15 +0100 Subject: [PATCH] sql report group of sensors --- sql-grep-to-ids.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 sql-grep-to-ids.sh diff --git a/sql-grep-to-ids.sh b/sql-grep-to-ids.sh new file mode 100755 index 0000000..0dafbbb --- /dev/null +++ b/sql-grep-to-ids.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e + +ids=$( grep $1 subvision-numbers.txt | awk '{ print $2 }' | xargs echo -n | sed 's/ /,/g' ) +#echo "select pn,count(pn),min(time),max(time) from zc where pn in ($ids) group by pn order by max" | psql zc +echo "select (select sub from sub where pn = zc.pn),(select name from sub where pn = zc.pn),pn,count(pn),min(time),max(time) from zc where pn in ($ids) group by pn order by max" | psql zc +echo "select * from zc where pn in ($ids) | psql zc" -- 2.20.1