Skip to content

Instantly share code, notes, and snippets.

@bensonk
Created August 4, 2010 04:55
Show Gist options
  • Select an option

  • Save bensonk/507663 to your computer and use it in GitHub Desktop.

Select an option

Save bensonk/507663 to your computer and use it in GitHub Desktop.
select observations.*, rankings.*
from observations inner join rankings on observations.behavior = rankings.code
where rankings.rank = (select max(rankings.rank)
from observations join rankings on observations.behavior = rankings.code
group by brand);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment