opendentalsupport.com is an independent community resource. We are NOT affiliated with, endorsed by, or sponsored by Open Dental Software, Inc. Open Dental® is a registered trademark of Open Dental Software, Inc.

Referral Tracking by Referring Doctor

SQL Queries3 min read4/2/2026

If you are trying to determine which local dentists or specialists are sending the most patients to your practice, you need a clear way to pull that data. This open dental referral tracking query allows you to see exactly which referring doctors are responsible for your new patient growth within a specific timeframe.

The Query

Copy and paste the following code into your User Query window. You can adjust the FromDate and ToDate variables at the top to change the reporting period.

SET @FromDate = '2026-01-01';
SET @ToDate = '2026-03-31';

SELECT 
    r.LName AS 'Ref Last Name',
    r.FName AS 'Ref First Name',
    COUNT(ra.PatNum) AS 'Total Referred Patients'
FROM referral r
INNER JOIN refattach ra ON r.ReferralNum = ra.ReferralNum
INNER JOIN patient p ON ra.PatNum = p.PatNum
WHERE ra.RefDate >= @FromDate 
AND ra.RefDate <= @ToDate
AND ra.IsFrom = 1
AND p.PatStatus = 0
GROUP BY r.ReferralNum
ORDER BY COUNT(ra.PatNum) DESC;

How to Run This Query

  1. In Open Dental, go to Reports in the Main Menu.
  2. Click User Query.
  3. Paste the query provided above into the large text box.
  4. Click Submit Query.
  5. The results will display in the grid below.

Understanding the Results

How to Customize

You can easily modify this query to fit your needs:

Variations

If you want to see the specific names of the patients referred by these doctors rather than just a total count, you can use this variation:

SET @FromDate = '2026-01-01';
SET @ToDate = '2026-03-31';

SELECT 
    r.LName AS 'Ref Last Name',
    r.FName AS 'Ref First Name',
    p.LName AS 'Patient Last',
    p.FName AS 'Patient First',
    ra.RefDate AS 'Date Referred'
FROM referral r
INNER JOIN refattach ra ON r.ReferralNum = ra.ReferralNum
INNER JOIN patient p ON ra.PatNum = p.PatNum
WHERE ra.RefDate >= @FromDate 
AND ra.RefDate <= @ToDate
AND ra.IsFrom = 1
AND p.PatStatus = 0
ORDER BY r.LName, ra.RefDate;

Skip the Query — Use DentalCanvas Instead

Don't want to write SQL? DentalCanvas connects to your Open Dental database and shows you this data automatically in a visual dashboard — no queries required.


This article is provided by opendentalsupport.com, an independent community resource. We are not affiliated with Open Dental Software, Inc.

Stop Writing SQL.

DentalCanvas connects directly to your Open Dental database and shows you production, collections, scheduling, and more — in a visual dashboard you can understand at a glance. No queries. No exports. Just answers.

Try DentalCanvas

Was this article helpful?

Related Articles

opendentalsupport.com is an independent community resource. We are NOT affiliated with, endorsed by, or sponsored by Open Dental Software, Inc. Open Dental® is a registered trademark of Open Dental Software, Inc.