[CentralOH] Question > Django > Querys > comparing fields from same record.
eric at intellovations.com
Tue Sep 15 23:57:30 CEST 2015
For that, you'll want to use Django's F() objects. F stands for 'field' (or
column). So assuming your Django model for the MyTable table is also called
from django.db.models import F
from yourapp.models import MyTable
results = MyTable.objects.filter(foo=F('bar'))
More information can be found here:
On Tue, Sep 15, 2015 at 5:44 PM, John Cassidy <jocassid at gmail.com> wrote:
> I'm trying to perform a query like this:
> SELECT *
> FROM MyTable
> WHERE MyTable.foo = MyTable.bar
> Is there a way to create a where clause like this using the filter
> method? If not how could this be done?
> -John Cassidy
> CentralOH mailing list
> CentralOH at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the CentralOH