sql report group of sensors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 22 Dec 2022 10:53:15 +0000 (11:53 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 22 Dec 2022 10:53:15 +0000 (11:53 +0100)
sql-grep-to-ids.sh [new file with mode: 0755]

diff --git a/sql-grep-to-ids.sh b/sql-grep-to-ids.sh
new file mode 100755 (executable)
index 0000000..0dafbbb
--- /dev/null
@@ -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"