Re: simple query question: return latest
От | Scott Frankel |
---|---|
Тема | Re: simple query question: return latest |
Дата | |
Msg-id | DEA51CC8-34CC-11D9-B6EE-000A95A7B782@pacbell.net обсуждение исходный текст |
Ответ на | Re: simple query question: return latest (Michael Fuhr <mike@fuhr.org>) |
Список | pgsql-general |
On Nov 12, 2004, at 8:24 AM, Michael Fuhr wrote: > [Top-posting fixed] > > On Fri, Nov 12, 2004 at 09:06:08AM -0500, Goutam Paruchuri wrote: > >> Scott Frankel wrote: >> >>> ORDER BY DESC LIMIT 1 is much simpler and more readable than a >>> sub-query. Though the sub-query approach looks to be a good template >>> for ensuring more accurate results by being more explicit. > > Scott, how would a subquery "ensure more accurate results by being > more explicit"? > Good question. I'm just now starting to construct sub-queries. Perhaps naively, I assumed that setting g.date explicitly equal to the results of a MAX function would return more reliable results than limiting a return list to just the first value listed. Though it's entirely possible that both approaches use the same logic under the hood. Nonetheless, I'm using the DESC LIMIT 1 approach for now as it yields the results I need and is much more readable. Thanks again! Scott
В списке pgsql-general по дате отправления: