Skip to content

Instantly share code, notes, and snippets.

@chapeupreto
Created November 6, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapeupreto/109abbdd7b20c977dd58 to your computer and use it in GitHub Desktop.
Save chapeupreto/109abbdd7b20c977dd58 to your computer and use it in GitHub Desktop.
SQL query that shows the number of total and allocated IPs for each pool that exists in radippool table
SELECT
pool_name,
COUNT(*) AS total,
(SELECT
COUNT(*)
FROM
radius.radippool r2
WHERE r1.pool_name = r2.pool_name
AND NASIPAddress <> ''
GROUP BY pool_name) AS allocated
FROM
radius.radippool r1
GROUP BY pool_name
ORDER BY pool_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment