On 2013.06.13 7:22 PM, Yongil Jang wrote:
Thank you, Richard and James.
2013/6/14 James K. Lowden <jklow...@schemamania.org>
Why not simply
SELECT f.name, count(e.food_id) as 'episodes'
FROM foods as f
OUTER
JOIN foods_episodes as e
ON f.id = e.food_id
GROUP BY f.name
ORDER BY episodes DESC LIMIT 10;
In my opinion,
That example is used in beginning of SQL chapter, therefore, JOIN and GROUP
BY is not explained yet.
That seems kind of backwards. Joining is a simpler operation than subqueries,
or at least is no more complicated. It seems strange to be talking about
subqueries before you talk about joins or grouping. On the other hand, I
suppose from an explanation point of view, a subquery in the SELECT list could
actually be a simpler thing to explain to a SQL newbie, so maybe that's why it
is first. -- Darren Duncan
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users