In a MySQL table, I would like to write 10 records with DISTINCT .
I am using Zend Framework.
$select = $this->getAdapter()->select() ->from('table', 'column')->group('column') ->limit(10, 0);
This is a request generated by the above code.
SELECT table.column FROM table GROUP BY column LIMIT 10
What happens here is that MySQL takes 10 records and then applies the group. So finally, I get only 7 entries.
How to apply DISTINCT first, and then take 10 records from it?
source share