Skip to content

Instantly share code, notes, and snippets.

@oleander
Created April 1, 2011 23:18
Show Gist options
  • Save oleander/899037 to your computer and use it in GitHub Desktop.
Save oleander/899037 to your computer and use it in GitHub Desktop.
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