Custom SQL Reports
Custom SQL reports let advanced users write their own database queries to extract data that isn't covered by the built-in report types. If you know SQL, you can query your EventWorks data directly and create highly specific reports tailored to your exact needs.
Note: This feature is designed for users comfortable with SQL. If you're not familiar with SQL, the 50+ built-in report types will likely cover what you need — see Reports Overview.
Getting There
- Click Reports in the sidebar.
- Click Create.
- Select Custom SQL from the report type dropdown.
- Click Next.
- Give the report a name and enter your SQL query in the large text area on the configuration page.
- Click Save.
Writing Your Query
The configuration page provides a text area where you enter a SQL SELECT statement. The query runs against your tenant's database using a read-only connection, so there is no risk of accidentally modifying data.
Basic Example
SELECT name, start_date, reported_price
FROM crm_events
WHERE start_date >= '2026-01-01'
ORDER BY start_date
This returns events starting from January 2026, showing their name, date, and price.
Joining Tables
You can join multiple tables for more complex queries:
SELECT e.name AS event_name,
a.name AS account_name,
e.start_date,
e.reported_price
FROM crm_events e
LEFT JOIN crm_accounts a ON e.account_id = a.id
WHERE e.start_date >= '2026-01-01'
ORDER BY e.start_date
Rules and Limitations
Custom SQL reports have safeguards to protect your data and system performance.
Allowed Operations
- Only
SELECTstatements — You can read data but not change it.
Blocked Operations
The following are not permitted:
| Blocked | Examples |
|---|---|
| Data changes | INSERT, UPDATE, DELETE, REPLACE |
| Structure changes | CREATE, ALTER, DROP, TRUNCATE |
| Permission changes | GRANT, REVOKE |
| Prepared statements | PREPARE, EXECUTE, CALL |
| Transaction control | BEGIN, COMMIT, ROLLBACK |
| Multiple statements | You cannot run more than one query (no semicolons separating statements) |
| UNION queries | Combining multiple SELECT statements with UNION is not allowed |
Performance Limits
| Limit | Value |
|---|---|
| Query timeout | 10 seconds — queries that take longer are automatically stopped |
| Row limit | 1,000 rows — if your query returns more, only the first 1,000 are shown. If you don't include a LIMIT clause, one is added automatically |
Security Restrictions
To protect sensitive data and system integrity:
- System databases — You cannot query
information_schema,performance_schema,mysql, orsysdatabases - Sensitive columns — Queries referencing columns named
password,secret,token, orkeyare blocked - Dangerous functions — Functions like
SLEEP,BENCHMARK,LOAD_FILE, andSYSTEM_USERare not allowed - String manipulation functions —
CONCAT,CHAR,UNHEX,FROM_BASE64,CAST, andCONVERTare blocked for security reasons - System variables — You cannot access system variables (those starting with
@@) - Hex and binary literals — Hex notation and binary literals are blocked
- Comments — SQL comments are stripped before execution
Exporting Results
Like all reports in EventWorks, custom SQL report results can be exported:
- CSV — Download the results as a spreadsheet file
- Excel — Download in native Excel format (.xlsx)
- PDF — Download a print-ready document
The column names from your SQL query become the column headers in the export. Use meaningful aliases (e.g. SELECT name AS "Event Name") to make your exports more readable.
Scheduling SQL Reports
Custom SQL reports support scheduling just like any other report type. Set a frequency (daily, weekly, or monthly), choose a time, and add recipients. See Scheduling Reports for full details.
Common Tables
Here are the most commonly used tables in your tenant database:
| Table | Contains |
|---|---|
crm_events |
Events |
crm_accounts |
Accounts (clients, suppliers, venues) |
crm_contacts |
Contacts |
crm_costs |
Event costs / line items |
crm_invoices |
Invoices |
crm_resources |
Resources |
crm_resource_types |
Resource types |
crm_tags |
Tags |
Tip: Start by exploring these common tables. Use SELECT * FROM crm_events LIMIT 10 to see available columns before building a more specific query.
Tips & Best Practices
Tip: Start with a simple query and build up. Test with a LIMIT 10 clause first to make sure your query returns the right data, then remove or increase the limit.
Tip: Use column aliases (AS) to give your output columns clear, human-readable names. This is especially important for exports —"Event Name"is much clearer thannamewhen multiple tables are joined.
Tip: Add WHERE clauses to narrow your results. Querying large tables without filters may hit the 10-second timeout on accounts with large datasets.
Tip: Only select the columns you need — avoid SELECT * on large tables. This improves performance and keeps your results focused.
Tip: Save multiple SQL reports with different queries for different needs. Name them clearly so you know what each one does (e.g. "Events Without Venues 2026" or "High-Value Lost Events Q1").
Warning: If your query references a blocked operation or restricted function, the error message will tell you which rule was violated. Review the rules above and adjust your query.
Frequently Asked Questions
Q: Can I modify data with a SQL report?No. SQL reports use a read-only database connection. Only SELECT statements are allowed — any attempt to insert, update, or delete data is blocked.
Check that your query:
- Is a single
SELECTstatement (no semicolons separating multiple queries) - Doesn't reference blocked databases or sensitive columns
- Doesn't use blocked functions (CONCAT, SLEEP, etc.)
- Doesn't use UNION clauses
- Doesn't include system variables (
@@)
The error message will usually indicate which rule was violated.
Q: My query is timing out. What can I do?- Add more specific
WHEREclauses to reduce the data scanned - Add a
LIMITclause to cap the results - Avoid
SELECT *— only select the columns you actually need - Filter on indexed columns (event dates, IDs, and statuses are typically indexed)
No. SQL reports are restricted to your own tenant database. Cross-tenant queries and queries to system databases are blocked.
Q: Can I use GROUP BY and aggregate functions?Yes. GROUP BY, COUNT, SUM, AVG, MIN, MAX, and other standard aggregate functions work normally.
These functions are blocked as a security precaution to prevent certain types of SQL injection techniques. If you need to combine or format strings, consider doing that in a spreadsheet after exporting the raw data.
Q: Can I schedule a SQL report?Yes. SQL reports support scheduling just like any other report type. See Scheduling Reports.