Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Retrieve certain number of rows per category

Hello all!

I have a data source that's a MySQL DB. Within that is a huge table (+10million rows) which I don't wish to refresh in its entirety everytime.

Keeping the first rows is simple, but how do I keep the first rows for each distinct category in the table?

 

In my case the data is identified by customer name, so how would I got about writing a query to retrieve the first 10,000 rows for each customer?

 

Thanks!

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      That helped thanks.

       

      I now have a new problem, which is that some of the columns are titled with a dot in their name

       

      e.g. customer.name

       

      The query refuses to accept these, square brackets and backticks don't help either. Any ideas?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous,

        Please open a new thread about the new issue.

        Regards,
        Lydia