Re: sorting different in postgres than in sqlite

2009-07-01 Thread J
Coalesce() worked in postgres as well. Thank you. On Jun 30, 10:34 pm, J wrote: > Thank you Tim, that worked perfectly in sqlite, and I imagine it will > work well inpostgresas well. My server is down right now, so I can't > say for sure, but I will definitely try this out.

Re: sorting different in postgres than in sqlite

2009-06-30 Thread J
Thank you Tim, that worked perfectly in sqlite, and I imagine it will work well in postgres as well. My server is down right now, so I can't say for sure, but I will definitely try this out. Thanks again, J On Jun 30, 3:10 pm, Tim Chase wrote: > > Here's my

Re: sorting different in postgres than in sqlite

2009-06-30 Thread Tim Chase
> Here's my query, (I'm using the stable release version of django, > otherwise I'd use "annotate" which I found is present in the > development version). > > contest = Participant.objects.extra(select={ >'contest_stats': """ > SELECT SUM(amt) > FROM

Re: sorting different in postgres than in sqlite

2009-06-30 Thread J
That's a good point. Thanks Jeff. The reason they are none, or have a null value, is because there are actually no related records in the related table. Two Tables: Participants (contains all potential participants) Data (contains actual participant activity) If there is a way to convert those

Re: sorting different in postgres than in sqlite

2009-06-30 Thread Jeff FW
Any reason not to make the total 0 instead of None? Null in database (or None in Python) has a special meaning, and it doesn't always make sense to sort a list of (mostly) integers with some null values. -Jeff On Jun 30, 2:01 am, J wrote: > Hello, > > I developed an app

sorting different in postgres than in sqlite

2009-06-30 Thread J
Hello, I developed an app for an online contest. In this app, I requested a queryset with totals from a related table, and wanted to display the top ten participants. So, I sorted the queryset on the totals field, descending. Some participants didn't have any items, so the total for these was