Jump to content

LIMIT on a JOIN (can't work it out!)


gausie

Recommended Posts

SELECT E1.name AS name, E1.id AS id, E2.name AS parentname FROM categories AS E1 INNER JOIN categories AS E2 ON E1.parent_id = E2.id WHERE E2.parent_id = '0' ORDER BY E1.amount ASC

 

So I want to limit the results from E1 (for each E2 record) to 5 only

 

How can I do that?

 

Gausie

Link to comment
https://forums.phpfreaks.com/topic/98489-limit-on-a-join-cant-work-it-out/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.