Re: Feedback about Drupal SQL debugging

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Feedback about Drupal SQL debugging
Дата
Msg-id 407d949e0908211831r18cb498av5fc172b96210317f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Feedback about Drupal SQL debugging  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: Feedback about Drupal SQL debugging  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
2009/8/22 Stephen Frost <sfrost@snowman.net>:
> * Greg Stark (gsstark@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 NULLGROUP 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Feedback about Drupal SQL debugging
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Feedback about Drupal SQL debugging