Re: Compare column entries in database query
Hi Russ! Thanks for the info! Saves me from trying around more. Yours, Thomas On Aug 2, 1:25 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 8/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > I want to find all entries in a database where two specific fields are > > equal: > > > mytable.objects.filter(column_a='column_b') > > At present, the answer is unfortunately 'you can't do this' (unless > you use a hack like the one you mentioned). > > I've had a few ideas on how to fix this; however, fixing this area of > code would require changes to an area that is currently undergoing a > major refactor. Once the query engine changes are complete, I have a > number of issues to address - this is one of them. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Compare column entries in database query
On 8/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I want to find all entries in a database where two specific fields are > equal: > > mytable.objects.filter(column_a='column_b') At present, the answer is unfortunately 'you can't do this' (unless you use a hack like the one you mentioned). I've had a few ideas on how to fix this; however, fixing this area of code would require changes to an area that is currently undergoing a major refactor. Once the query engine changes are complete, I have a number of issues to address - this is one of them. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Compare column entries in database query
Hi everybody! I want to find all entries in a database where two specific fields are equal: mytable.objects.filter(column_a='column_b') But this gives me no results at all. I now managed to get it done with a .extra(), but I was wondering if this is the only possible solution. All examples in the documentation work with static values for comparison and there are no further details about the right hand side of the query. Thanks for reading! Thomas. P.S.: Here's the query which get's the work done: mytable.objects.extra(where=['column_a=column_b']) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---