It seems to me that this should be invalid as COUNT(id) does not refer to a
valid field in the subquery's column list. I would vote for throwing an
error as it seems that wrong. Since its been over six years since I wrote
that query, I don't know what I was thinking at the time.
Sent from my iPhon
On 2013.06.13 7:22 PM, Yongil Jang wrote:
Thank you, Richard and James.
2013/6/14 James K. Lowden
Why not simply
SELECT f.name, count(e.food_id) as 'episodes'
FROM foods as f
OUTER
JOINfoods_episodes as e
ON f.id = e.food_id
GROUP BY f.name
ORDER BY episodes DESC LIMIT 10;
Thank you, Richard and James.
2013/6/14 James K. Lowden
>
>
> Why not simply
>
> SELECT f.name, count(e.food_id) as 'episodes'
> FROM foods as f
> OUTER
> JOINfoods_episodes as e
> ON f.id = e.food_id
> GROUP BY f.name
> ORDER BY episodes DESC LIMIT 10;
>
>
In my opinion,
That ex
On Thu, 13 Jun 2013 08:13:29 -0400
Richard Hipp wrote:
> SELECT
> name,
> (SELECT COUNT(food_id) FROM foods_episodes WHERE food_id=f.id) count
> FROM
> foods f
> ORDER BY count DESC LIMIT 10;
...
> SELECT
> name,
> (SELECT COUNT(*) FROM foods_episodes WHERE food_id=f.id) count
> FROM
>
On Thu, Jun 13, 2013 at 12:24 AM, Yongil Jang wrote:
> Dear all,
>
> Following select query returns different result data between v3.7.11 and
> v3.7.13~.
>
> CREATE TABLE foods(
> id integer primary key,
> type_id integer,
> name text );
> CREATE TABLE foods_episodes(
> food_id integer,
>
5 matches
Mail list logo