2009/8/22 Stephen Frost <sfr...@snowman.net>:
> * Greg Stark (gsst...@mit.edu) wrote:
>> You would have to specify the key. I think typically you would have
>> something like:
>>
>> SELECT a.*, sum(b.col)
>>    FROM a,b
>>  GROUP BY a.pk
>
> Ahhh, ok, this makes more sense.  This is SQL standard?

Incidentally it makes even more sense that MySQL would do what they do
when you remember that they didn't have subqueries until recently. So
MySQL programmers had all become accustomed to the circumlocutions
like:

SELECT a.*
    FROM a left join b USING (a.b_id = b.id)
 WHERE b.id IS NULL
 GROUP BY a.id

to express the much simpler

select * from a where b_id in (select id from b)

So not many uses of it in MySQL actually *would* be valid if we
implemented the shortcut. But MySQL doesn't enforce that so it serves
that purpose as well as what we get out of DISTINCT ON.

-- 
greg
http://mit.edu/~gsstark/resume.pdf

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to