MySQL Forums
Forum List  »  General

basic join question
Posted by: Mark Moon
Date: May 19, 2012 04:00PM

I posted below to Newbie section, but think that might have been mistake. Sorry if it belongs there...

I have a basic join question using MySQL 5.1.61 in Squeeze, at least I think it's a basic question. Here's the set up:

Table A has unique dates,

Table B has unique dates, ids, and values.

I'd like to create a new table, that has:

- for each unique date,

- the top N ids and values, top N being sorted by values descending.

So, for example, if I have 5 unique dates, and N is 10, I want a new table which would have 50 records (the top 10 for each of the 5 unique dates - I'm assuming I have at least N entries for each unique date). So top N for each group.

Very simple in principal, but haven't yet figured out how to do this.

Any help will be greately appreciated!

Mark

Options: ReplyQuote


Subject
Written By
Posted
basic join question
May 19, 2012 04:00PM
May 20, 2012 01:57PM
May 20, 2012 06:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.