Basic Giving Queries
Start here to learn the fundamentals of querying your church’s giving data. Each example builds on the previous one, helping you gain confidence with SQL.Query Customization Required
These example queries demonstrate common patterns but may require adjustments to match your specific database schema and field names. Test thoroughly in your environment before use.
Query Requirements
Schema Prefix
IMPORTANT: All tables in the Planning Center Giving module live in theplanning_center
schema. Always prefix table names with planning_center.
in your queries.
✅ CORRECT: SELECT * FROM planning_center.giving_donations
❌ INCORRECT: SELECT * FROM giving_donations
Row Level Security (RLS)
Row Level Security automatically scopes results by:- tenant_organization_id – only your organization’s data
- system_status – only active records by default
- ❌
WHERE tenant_organization_id = 1
- ❌
WHERE system_status = 'active'
Table of Contents
- Viewing Recent Donations
- Finding Donors
- Working with Funds
- Date-Based Queries
- Payment Methods
- Basic Aggregations
Viewing Recent Donations
See Your Latest Donations
Filter by Donation Amount
Finding Donors
List All Active Donors
Search for a Specific Donor
Connect Donations to Donors
This query shows how to link donations with donor information using the relationship table:Working with Funds
List All Available Funds
See How Donations Are Designated
Connect Donations to Their Fund Designations
Date-Based Queries
Donations This Month
Donations by Week
Year-to-Date Giving
Payment Methods
Breakdown by Payment Method
Online vs Check Giving
Basic Aggregations
Daily Giving Summary
Top Donors This Month (Anonymous)
Fund Performance Summary
Tips for Writing Queries
1. Always Convert Cents to Dollars
2. Filter Out Refunded Donations
3. Use received_at for Timing
received_at
= When the donation was actually receivedcreated_at
= When it was entered into the systemcompleted_at
= When the transaction completed (may be NULL)
4. Handle NULL Values
5. Case-Insensitive Searches
Next Steps
Ready for more complex queries? Check out:- Advanced Queries - Multi-table joins, subqueries, and complex aggregations
- Reporting Examples - Complete reports you can use immediately