# Session Query Not Pulling Everything

**URL:** <https://community.open-emr.org/t/session-query-not-pulling-everything/19625>\
**Category:** Day-to-Day Users\
**Created:** [December 13, 2022, 9:13pm UTC](https://community.open-emr.org/t/session-query-not-pulling-everything/19625 "2022-12-13T21:13:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmnlbh](https://community.open-emr.org/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@dmnlbh](https://community.open-emr.org/u/dmnlbh)\
**Post date:** [December 13, 2022, 9:13pm UTC](https://community.open-emr.org/t/session-query-not-pulling-everything/19625/1 "2022-12-13T21:13:38Z")

</div>

We are trying to pull all the encounter data for the day for all of our clinicians. There is a subset of our clinicians, interns, that are not being pulled using this query. They work with clients that don’t have any insurance, so they don’t have an insurance identified. I’m not sure if that is it or not. Here is the query we are using. Any thoughts on why only that group of clinicians and their clients are not being pulled?

```auto
SELECT
p.fname, 
p.lname, 
pc.pc_pid, 
p.DOB, 
pc.pc_eventDate, 
pc.pc_startTime, 
pc.pc_title,
pc.pc_hometext,
CONCAT(u.fname, ' ', u.mname, ' ', u.lname) Provider
FROM
patient_data p
LEFT JOIN
openemr_postcalendar_events pc ON p.pid = pc.pc_pid
LEFT JOIN users u ON u.id = pc.pc_aid
WHERE pc.pc_eventDate = "2022-10-10"
ORDER BY pc.pc_startTime ASC
;
```

---

<div class="post-metadata">

**Author:** ![stephenwaite](https://community.open-emr.org/user_avatar/community.open-emr.org/stephenwaite/32/15754_2.png) [@stephenwaite](https://community.open-emr.org/u/stephenwaite)\
**Post date:** [December 13, 2022, 10:26pm UTC](https://community.open-emr.org/t/session-query-not-pulling-everything/19625/2 "2022-12-13T22:26:13Z")

</div>

are any of the appointments recurring?

---

<div class="post-metadata">

**Author:** ![dmnlbh](https://community.open-emr.org/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@dmnlbh](https://community.open-emr.org/u/dmnlbh)\
**Post date:** [December 13, 2022, 10:55pm UTC](https://community.open-emr.org/t/session-query-not-pulling-everything/19625/3 "2022-12-13T22:55:41Z")

</div>

They are mostly recurring, but when they get confirmed the appointment type changes to a confirmed appointment (we created a calendar entry for Hold appointments that are typically recurring). All of our other clinicians use the same system described above and their session data pulls over.

One of our former staff members implemented this query, so I’m not sure if it pulls from the calendar or the encounter notes that were created.
