Skip to content

Instantly share code, notes, and snippets.

@lcowell
Last active December 28, 2015 13:19
Show Gist options
  • Save lcowell/7507115 to your computer and use it in GitHub Desktop.
Save lcowell/7507115 to your computer and use it in GitHub Desktop.
SELECT r.staff_member_id, concat_ws(' ', u1.first_name, u1.last_name) staff_name,
r.patient_id, concat_ws(' ', u2.first_name, u2.last_name) patient_name
from company_10.transaction_report r
join staff_members s on s.id=staff_member_id
join patients p on p.id=patient_id
join users u1 on s.id=u1.staff_member_id
join users u2 on s.id=u2.patient_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment