Just do be clear... you are mixing strings and numbers in one table on
different rows? I think your data structure is wrong and you will not be
able to achieve what you're trying.
I'd would be easy if the table would look like this:
+-----------------+
|Activities |
+---------+-------+
|Activity | Number|
+---------+-------+
|activity1| 0|
|activity2| 1|
|activity3| 2|
|activity4| 3|
|activity5| 4|
+---------+-------+
then you would be able to do something like this:
Activities.objects.all().order_by("-Number")[:3]
Am Mittwoch, 24. Juli 2013 08:08:42 UTC+2 schrieb sandy:
>
> Suppose I have following table in my database :
>
> activity1 | activity2 | activity3 | activity4 | activity5
> 6 | 7 | 5 | 9 | 8
>
> The first row are the field names and the second row are the data
> entries. How can I get 3 maximum values out of each row of this table?
> Like from this row, I should get 7,8,9.
> Eagerly waiting fro your reply.
> Thank you.
>
> --
> Sandeep Kaur
> E-Mail: [email protected] <javascript:>
> Blog: sandymadaan.wordpress.com
>
--
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users.
For more options, visit https://groups.google.com/groups/opt_out.