MySQL Forums
Forum List  »  Performance

Re: Performance on 2 table operations
Posted by: Rick James
Date: January 02, 2013 04:59PM

DynID should be the same type in both tables. (But I don't think that is a performance issue, in this case.)

Would this give you the ids of the desired writers?
SELECT  DynId, MAX(WriteDate) AS Latest
    FROM  publications
    GROUP BY  DynId
    ORDER BY  Latest DESC
    LIMIT  5;

If so, then something like this might be close to what you want:
SELECT  w.*
    FROM  
      ( SELECT  DynId, MAX(WriteDate) AS Latest
            FROM  publications
            GROUP BY  DynId
            ORDER BY  Latest DESC
            LIMIT  5
      ) x
    JOIN  writers w ON w.DynId = x.DynId

Options: ReplyQuote


Subject
Views
Written By
Posted
1894
December 29, 2012 03:23AM
Re: Performance on 2 table operations
981
January 02, 2013 04:59PM


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.