listView -- trying to get related data for each item

Hello!

I have three tables -- one contains notes for the day, one contains a list of employees, and one contains a list of employees who have acknowledged reading the notes

passons - passon_id, employee_id, note
employees - employee_id, name
passon_acknowledgements - id, passon_id, employee_id

I'm having trouble trying to find a way to get the associated acknowledgements for each pass on. Admittedly may be a bit out of my depth so not sure if I'm even approaching this the right way. Any help would be appreciated!



Hi @trash!

What kind of information would you ideally like to gather?

Here's a sample SQL query that joins 3 tables:

SELECT

student.first_name,

student.last_name,

course.name

FROM student

JOIN student_course

ON student.id = student_course.student_id

JOIN course

ON course.id = student_course.course_id;

And here is that query using your tables/columns (note! This may not work as is. I'm not familiar with your exact setup, so it may take some tweaking, but the concept of JOINing and matching id columns should be about the same :slightly_smiling_face:)

SELECT

p.passon_id, p.employee_id, p.note

e.name,

pa.id

FROM passons p

JOIN employees e

ON p.employee_id = e.employee_id

JOIN passon_acknowledgements pa

ON pa.passon_id = p.passon_id;

Here's a few external docs that review JOINing multiple tables:

https://www.geeksforgeeks.org/joining-three-tables-sql/

https://www.educative.io/edpresso/how-to-join-3-or-more-tables-in-sql

https://javarevisited.blogspot.com/2012/11/how-to-join-three-tables-in-sql-query-mysql-sqlserver.html#axzz7KWRMJUUN

@trash,

Off topic, but how did you get the script font? Images, hacking the CSS, something else?