Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- create date isn't important so long as the account is still valid
- -- expire_date is because it should only look three years out for the expiration
- -- same forumla as always used but adjusted in 2012 per board to change interval to 3 years
- select count(au.id) AS "Number of Patrons", paou.name AS "Library Name"
- from actor.usr au
- join actor.org_unit aou on aou.id = au.home_ou
- join actor.org_unit paou on paou.id = aou.parent_ou
- where au.active = TRUE
- and au.deleted = FALSE
- and au.expire_date < now() + interval '3 years'
- group by paou.name
- order by paou.name
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement