Like Takashi says.. you can effectively get the max() for a numeric property
(db.FloatProperty() or db.IntegerProperty()) by issuing a command like he
gave.. or a more SQL looking query like this:
result = db.GqlQuery("Select * from Employee Order By salary desc").fetch(1)
maxsalary = result[0].salary
Other built in SQL functions like Sum() aren't really doable though. (Not in
a simple way).
On Sun, Mar 14, 2010 at 10:12 PM, Takashi Matsuo
<[email protected]>wrote:
> Hi,
>
> Perhaps you can order by salary property descending, and just get the
> first one, for getting max value.
>
> max_salaried_employee = Employee.all().order("-salary").get()
> max_salary = max_salaried_employee.salary
>
> hope this helps
>
> --
> Takashi Matsuo
> Kay's daddy
>
>
>
> On Mon, Mar 15, 2010 at 11:00 AM, Greg <[email protected]> wrote:
> > On Mar 14, 3:48 am, pyrocks <[email protected]> wrote:
> >> here shall we have any max() function available like in oracle to find
> >> max salaried employee.
> >
> > In a word, no. You need to store the maximum salary in the datastore,
> > and every time time a salary changes check to see if it exceeds the
> > maximum, and update it if so.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.