Jump to content

MySQL SELECT within SELECT taking forever...


Go to solution Solved by Barand,

Recommended Posts

So what songs in my collection are cover versions of Bob Dylan songs? I wrote this query to find out:

$query = "Select artist from songlist
            where title in
            (Select distinct title
            from songlist
            where artist='Bob Dylan')";

but running it times out. If I substitute the inner select for a simple list of, say, three or four of his songs, the query runs fine so I can only assume that the thousands of permutations are what's slowing things down. Is there a more efficient way of achieving the same thing? Ultimately I'd like to replace 'Bob Dylan' with a variable, but first things first.

 

Thanks!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.