Count for .sql qurery
Hi There
Just created a .sql script and executes fine, it comes back with two lines of results, I was wondering is there a way of adding up the two results to get a round number. I tired wc -l but that didn't work. Many Thanks for your help Code: Code:
psql -t -f /opt/ca/SAP_Tooling/sql/self_monitoring/check_number_of_open_connections_database.sql Quote:
Quote:
|
Not sure if this will work but try:
Code:
select count(*), state from pg_stat_activity group by state WITH ROLLUP; |
probably awk... thinking something like
Code:
| awk '{users += $1} END {print users}' |
Hi Guys
Thanks for the responses @TenTenths - no unfortunately that didn't work - psql:/opt/ca/SAP_Tooling/sql/self_monitoring/check_number_of_open_connections_database.sql:1: ERROR: syntax error at or near "WITH ROLLUP" @r3sistance - Yes that worked :) great thank you. |
Quote:
Glad you got sorted by the other method though. :) |
All times are GMT -5. The time now is 07:17 AM. |