To save having to understand how the underlying db schema works:
SQL Queries for JIRA