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
Useamount_cents / 100.0 — the .0 forces a decimal result instead of integer division.
2. Filter Out Refunded Donations
AddWHERE refunded = false unless you specifically want refunds included.
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
UseIS NOT NULL to require a value and COALESCE to substitute a default.
5. Case-Insensitive Searches
Lowercase both sides soSmith, SMITH, and smith all match.
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