Jump to content

MySQL SELECT within SELECT taking forever...


Big_Pat

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.