Skip to content

Instantly share code, notes, and snippets.

@ansmirnov
Created January 13, 2016 18:14
Show Gist options
  • Save ansmirnov/9cfba53bc1118b91f0f8 to your computer and use it in GitHub Desktop.
Save ansmirnov/9cfba53bc1118b91f0f8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# aboncnt.sh <areaid> <status_code>
DB_USER=...
DB_PASS=...
DB_NAME=...
ADDRESS_PID=...
/bin/echo "SELECT count(DISTINCT c.id) FROM contract_parameter_type_2 as p INNER JOIN contract as c ON p.cid=c.id WHERE p.hid in (SELECT id FROM address_house WHERE areaid=$1) AND c.status = $2 AND p.pid=${ADDRESS_PID};" | /usr/bin/mysql --skip-column-names -u${DB_USER} -p${DB_PASS} ${DB_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment