+#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"