Im trying to display some client details in a pdf of attendances. My table structure is Clients, Matters, Attendances.
Clients can have one to many matters
Matters can have one to many attendances.
I want to see which client is related to the attendance "through" the matters table
SELECT c.FirstName, c.LastName, c.PhoneNumber
FROM clients c
JOIN matters
USING ( ClientID )
JOIN attendances
USING ( MatterID )
When i chuck this __sql__ function into my attendance delegate, i get the following error:
- Code: Select all
Fatal error: Failed parsing SQL query on select: SELECT c.FirstName,c.LastName FROM clients c JOIN matters USING ClientID) JOIN attendances USING MatterID . The Error was Parse error: Unexpected clause on line 4 JOIN matters USING ClientID) ^ found: "USING" in C:\wamp\www\live_matters\xataface\lib\SQL\Parser.php on line 1752
when i use the code in phpmyadmin, i do get results, but they are seemingly random: a list of 13 random first and last names of clients.