dbTalk Databases Forums  

simple query question: return latest

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss simple query question: return latest in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Scott Frankel
 
Posts: n/a

Default Re: simple query question: return latest - 11-12-2004 , 11:04 AM







On Nov 12, 2004, at 8:24 AM, Michael Fuhr wrote:

Quote:
[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


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.