Re: order by field length?

2008-12-16 Thread David Lindquist
Perfect. Exactly what I needed. Thank you Russ On Dec 16, 5:22 pm, "Russell Keith-Magee" wrote: > On Wed, Dec 17, 2008 at 9:04 AM, David Lindquist > > wrote: > > > I encountered a scenario where I need to query the database for a > > list of

Re: order by field length?

2008-12-16 Thread Russell Keith-Magee
On Wed, Dec 17, 2008 at 9:04 AM, David Lindquist wrote: > > I encountered a scenario where I need to query the database for a > list of names sorted by length. In SQL this is easy: > > SELECT name from distributors_distributor ORDER BY LENGTH(name) > > Instead of

order by field length?

2008-12-16 Thread David Lindquist
I encountered a scenario where I need to query the database for a list of names sorted by length. In SQL this is easy: SELECT name from distributors_distributor ORDER BY LENGTH(name) Instead of writing raw SQL in my view, I am doing this: names = [x['name'] for x in