Using LIMIT without separating similar data
Posted on 2008-10-22
Hi, I'm using MySQL with PHP and I have a query similar to this:
SELECT i.ID, i.total, c.custname FROM tblinvoices i
LEFT JOIN tblcustomers c ON c.ID=i.custid
ORDER BY c.ID
Is there a way to write this query to make it take less or more invoices depending on how many similar c.custnames there are at the end of the limit? Basically, I don't want to set the limit stop at a point between a couple similar custnames, so I don't have to go to the next set of invoices (1000,2000) to get the rest of the similar custnames that were cut off at 1000. I can't send the whole table and work with it in php because it exceeds the memory limits of php (there's a lot more than just 3 fields I'm getting from the real query).