Connection
-
The base structure is below. The CASE data should be concluded, but the ID of the lawyer(lawyer) and the ID of the client(client) should be replaced by the name of the client and lawyer from the other two related tables.
I tried to start with all the data from the three tables in a way:
SELECT * FROM cases JOIN client,lawyer ON (client.client_id=cases.client_id) AND (lawyer.lawyer_id=cases.lawyer_id)
But as you realized, something went wrong. I can't find any Synthaxis "ON" and because I don't know how it's supposed to be, and how JOIN's been working for a few days, even after reading dozens of documents... Can you help me?
Thank you for your attention!
-
Try splitting into 2 left joining and making different conditions.
SELECT * FROM cases LEFT JOIN client ON client.client_id=cases.client_id LEFT JOIN lawyer ON lawyer.lawyer_id=cases.lawyer_id