Getting the "latest" related record from a SQL DB

David Cantrell david at
Mon Oct 13 13:07:50 BST 2014

On Sun, Oct 12, 2014 at 05:00:10PM +0100, Andrew Beverley wrote:

> What I failed to say was that as well as doing this for a single artist
> as per my question, I'd like to also be able to do it for several
> artists. Therefore (I think) I can't use either of those options without
> doing several database queries. I also like to avoid sub-selects as
> MySQL has a tendency to optimise them badly (as Gareth said).

If you turn the sub-SELECT into a VIEW it seems to optimise them less

David Cantrell | Godless Liberal Elitist

    Deck of Cards: $1.29.
    "101 Solitaire Variations" book: $6.59.
    Cheap replacement for the one thing Windows is good at: priceless
        -- Shane Lazarus

More information about the mailing list