Created
April 1, 2011 23:18
-
-
Save oleander/899037 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, MATCH (songs.title) AGAINST ('Born Bruce') | |
AS song_score, | |
MATCH (artists.name) AGAINST ('Born Bruce') | |
AS artist_score | |
FROM songs | |
INNER JOIN `artists` ON `artists`.`id` = `songs`.`artist_id` | |
WHERE MATCH (artists.name) | |
AGAINST ('Born Burce') OR | |
MATCH (songs.title) | |
AGAINST ('Born Bruce') | |
HAVING (artist_score + song_score) > 10 | |
ORDER BY (artist_score + song_score) DESC | |
LIMIT 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment