All pastes #886463 Raw Edit

Miscellany

public text v1 · immutable
#886463 ·published 2008-01-31 18:16 UTC
rendered paste body
SELECT
	id,
	name,
	color,
	count(meals.id) as num_meals
FROM cats
join meals
	on meals.cat_id = cats.id
group by id,
	name,
	color
HAVING count(meals.id) > 3
ORDER BY name ASC