Skip to content

Instantly share code, notes, and snippets.

@mgreenly
Created May 7, 2014 20:12
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 mgreenly/89d2b7f1126c016ee587 to your computer and use it in GitHub Desktop.
Save mgreenly/89d2b7f1126c016ee587 to your computer and use it in GitHub Desktop.
select
count(*)
from
serial_numbers
join boats on
boats.id = serial_numbers.boat_id
join boat_sizes on
boat_sizes.id = boats.boat_size_id
join chassis on
chassis.id = boats.chassis_id
where
serial_numbers.value >= '82000'
and (not boats.cancelled)
and (not boats.hold)
group by
chassis.name, boat_sizes.name
order by
chassis.name asc,
boat_sizes.name asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment