Receiving the correct number of rows with an inner join

Written by

in

To receive the correct number of rows with an inner join we can use LIMIT and OFFSET on a sub-query.

SELECT id,field1,field2,field3,field4,field5 FROM (SELECT id,field1,field2,field3 FROM mytable ORDER BY id LIMIT 0,10) mytabled INNER JOIN myjointable USING (id);