I'm using MySql and not Postgres, but your example is actually a valid
query and should work.  Whenever possible and practical (as in this case),
you should use native sql functions instead of local python functions.

Using max() INSIDE the query puts the workload on the server, which is
exactly what it's tuned to do very efficiently.  Pulling back a whole
recordset and looking for the max, or doing two queries, brings the
workload to you, which is far more inefficient.

Are you seeing an error with this query?



On Mon, Jul 15, 2013 at 1:34 PM, Claudio Dusan Vega Ozuljevich <
[email protected]> wrote:

> Hi guys, I need to know how to perform a query like this one:
>
> SELECT city FROM weather
>     WHERE temp_lo = (SELECT max(temp_lo) FROM weather);
>
> As you can see is a Select nested inside another Select,
>
> In addition, is it possible to use the postgresql fuction (in this
> case max()) from web.py, or do I need to use another python module, in
> that case, which one do you recommend?
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/webpy.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to