w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
MySQL query with limit on parent table not on child table

Create a subquery with a limit, then create the join from there.

SELECT s.id, s.name, su.id, su.updates
FROM (select id, name from students limit 2) AS s
LEFT JOIN `student_updates` AS su ON s.id = su.sid




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.