Back to Website Development
Website Development

MySQL query returning duplicate rows on JOIN

Posted on March 16, 2026, 9:29 pm • 755 Views
I joined the Users table with the Orders table, and now a user is showing up 5 times in my results!
That happens when a user has 5 orders. A LEFT JOIN returns a row for every match in the right table. You either need to add `GROUP BY users.id` or fetch them separately in PHP.

You must be logged in to reply to this topic.

Login Register