Level 104
What is the criteria where 40 is the preferred result for B?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i have 2 table in my DB, job and job_detail job table have id, name and job_detail have id, job_id(fk), progress
i try this query
select *
from job j INNER JOIN job_detail jd on (j.id=jd.job_id)
and my query result like this
id name progress
1 A 20
2 B 2
2 B 40
i just want to get only like this
id name progress
1 A 20
2 B 40
can someone help me with this problem?? thx
SELECT j.id, j.name, jd.progress
FROM jobs j
INNER JOIN (
SELECT job_id, max(progress) AS progress
FROM job_details
GROUP BY job_id
) AS jd ON j.id = jd.job_id;
Please or to participate in this conversation.