Re: Database Query in Shell

2012-05-27 Thread Sandeep kaur
On Sun, May 27, 2012 at 6:05 PM, wrote: > To get a queryset containing all the objects where field == other_field > should be something like the following: > > from django.db.models import F > > Amounts.objects.filter(field = F("other_field")) > > to then update all those objects with "OTHER" as

Re: Database Query in Shell

2012-05-27 Thread mgc_django-users
On 27/05/2012 9:28 PM, Sandeep kaur wrote: I have a table Amounts which has 2 columns field and other_field. These columns are filled in such a way that either other_field is null or other_field = field. I want to make a database query such that if field == other_field : field = "OTHER" else

Database Query in Shell

2012-05-27 Thread Sandeep kaur
I have a table Amounts which has 2 columns field and other_field. These columns are filled in such a way that either other_field is null or other_field = field. I want to make a database query such that if field == other_field : field = "OTHER" else: field = field That means the entries in