Skip to content

Instantly share code, notes, and snippets.

@petedoyle
Created July 29, 2012 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petedoyle/3196300 to your computer and use it in GitHub Desktop.
Save petedoyle/3196300 to your computer and use it in GitHub Desktop.
# http://localhost:8080/v1/solution?solutionCategoryId=4942
select
this_.id as id3_1_,
this_.version as version3_1_,
this_.date_created as date3_3_1_,
this_.description as descript4_3_1_,
this_.import_source as import5_3_1_,
this_.import_source_collection_url as import6_3_1_,
this_.import_source_url as import7_3_1_,
this_.keywords as keywords3_1_,
this_.last_updated as last9_3_1_,
this_.original_photo_url as original10_3_1_,
this_.phone as phone3_1_,
this_.published_state as published12_3_1_,
this_.solution_category_id as solution13_3_1_,
this_.title as title3_1_,
this_.type as type3_1_,
this_.url as url3_1_,
this_.url_title as url17_3_1_,
solutionca3_.solution_id as solution1_3_,
solutionca1_.id as solution2_,
solutionca1_.id as id17_0_,
solutionca1_.version as version17_0_,
solutionca1_.date_created as date3_17_0_,
solutionca1_.last_updated as last4_17_0_,
solutionca1_.title as title17_0_
from solution this_
inner join solution_solution_categories solutionca3_
on this_.id=solutionca3_.solution_id
inner join solution_category solutionca1_
on solutionca3_.solution_category_id=solutionca1_.id
where ((solutionca1_.id=?))
order by lower(this_.title) asc
limit ?
# Effectively the same (but easier to read):
select solution.*, solution_solution_categories.*, solution_category.*
from solution
inner join solution_solution_categories
on solution.id = solution_solution_categories.solution_id
inner join solution_category
on solution_solution_categories.solution_category_id = solution_category.id
where solution.id = ?
order by lower(solution.title) asc
limit ?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment