SQL Statement Multiple Join Query Not Working

45
January 11, 2019, at 11:30 PM

I have a table called contracts and table called feedback. I also have table users with 3 users - with ids = 3, 8 and 10. I also have a jobposts table and jobposts.id=contracts.id=feedback.topic_id

I would like to show only one contract with details from all 3 tables. In other words employer-8 has hired applicant-3 and applicant-10 for the same job-54. But, I want to show only the contract between employer-8 and applicant-3.

Here is the data of feedback and contracts tables.

Here is the query that I have:

 $sql6 = "SELECT * FROM contracts INNER JOIN feedback ON contracts.topic_id=feedback.job_id INNER JOIN jobposts ON contracts.topic_id=jobposts.id INNER JOIN users ON contracts.employer_id=users.id WHERE contracts.applicant_id=3 AND finished=1 ";

When I run it without joining the feedback it's ok, but I want to show data from the feedback table and I need to join it. When I join with the feedback table, both contracts are shown. I tried with left join, and tried GROUP BY contracts.id but did not work. Does anyone have an answer?

READ ALSO
How to use mysql variables in joomla queries

How to use mysql variables in joomla queries

How do I use mysql variables inside of the Joomla! query builder and with loadObjectList()?

46
Can JobScheduler in Doze mode can connect network?

Can JobScheduler in Doze mode can connect network?

As Google document mentioned, JobScheduler can not work in Doze mode, Unless it is in temporal windowed periodic wake-up time

49
Cannot resolve symbol 'googleMap'

Cannot resolve symbol 'googleMap'

Hi i have a little problem with Google Maps APISo i followed this instruction https://developers

53
How to show a popup message after 1 min that any response is not coming from a server?

How to show a popup message after 1 min that any response is not coming from a server?

In below code, I am getting the response from a server, before getting the response from the server, I am giving 1 min timer to get the response

67