php - Preventing multi-row returns while using INNER JOIN and IN clause: MySQL -
I have several tables that I am joining together to return to the search results page. In the search page, the user can toggle the criteria, and the page is dynamically reloaded based on the query results. In this regard, I am having a challenge with a special condition - I have a table called jobs and there is another table for the job. One job can have one or more contract types. - Select the simple question to join both of them in a.job_id, c.contract_type_name, from the job on an Inner Join Job_SiteC Job_id = c.job_id This query works fine. However, if the user decides to toggle some contract types and chooses multiple contract types, then the query returns multiple rows with the same job ID. The query I am using is in the form of the following: SELECT a.job_id, c.contract_type_name Job from a job JOB_Centract C on an INNER JOB. A.job_id = c.job_id and c.contract_type IN (1,2, 4) So for the above code, if there are multiple contract type associations in a job then...