Re: SELECT N records from each category

2008-08-11 Thread Kevin Waterson
This one time, at band camp, Perrin Harkins [EMAIL PROTECTED] wrote: In your case, you might be able to just cheat it with some MySQL-specific LIMIT stuff: Thanks very much Perrin, this is most useful and I can take it from here. Kind regards Kevin -- MySQL General Mailing List For list

SELECT N records from each category

2008-08-10 Thread Kevin Waterson
I have 3 tables (schema below) with categories, questions and answers. Each category can of course have many questions in it. Also, the answers are multiple choice, so each question can have several related answers. I am trying to achieve 2 goals. 1) SELECT N questions and the related answers

Re: SELECT N records from each category

2008-08-10 Thread Peter Brawley
1) SELECT N questions and the related answers from each category. See Within-group quotas (Top N per group) at http://www.artfulsoftware.com/infotree/queries.php. PB Kevin Waterson wrote: I have 3 tables (schema below) with categories, questions and answers. Each category can of course

Re: SELECT N records from each category

2008-08-10 Thread Kevin Waterson
This one time, at band camp, Peter Brawley [EMAIL PROTECTED] wrote: See Within-group quotas (Top N per group) at http://www.artfulsoftware.com/infotree/queries.php. Yes, I have seen that, very clever. How does it relate to my situation? Simply point to vague references is not helpful. Kevin

Re: SELECT N records from each category

2008-08-10 Thread Peter Brawley
How does it relate to my situation? Simply point to vague references is not helpful. Vague? Not in the slightest. General? Indeed, by design. You'd written Any help in this matter hugely appreciated. If that's not so, please feel free entirely ignore my suggestion. PB - Kevin Waterson

Re: SELECT N records from each category

2008-08-10 Thread Kevin Waterson
This one time, at band camp, Peter Brawley [EMAIL PROTECTED] wrote: Vague? Not in the slightest. General? Indeed, by design. I have read this before.. It uses a single table, I am using multiple tables. I am not selecting the TOP 10 or whatever. This example has no relationships where the

Re: SELECT N records from each category

2008-08-10 Thread Peter Brawley
It uses a single table, I am using multiple tables. I am not selecting the TOP 10 or whatever. This example has no relationships where the schema I presented does. Eh? We can treat any query as one derived table; it makes no difference to the principle involved. And the same within-aggregate

Re: SELECT N records from each category

2008-08-10 Thread Perrin Harkins
On Sun, Aug 10, 2008 at 10:54 AM, Kevin Waterson [EMAIL PROTECTED] wrote: I have 3 tables (schema below) with categories, questions and answers. Each category can of course have many questions in it. Also, the answers are multiple choice, so each question can have several related answers. I am