Monday, April 3, 2017

Re: filter chaining v/s filter with multiple arguments.

Thank you for reply.

In case of second statement, why two JOIN are required each with single filter ?
As per my understanding whether it use one JOIN with both the filter or two JOIN each with single filter, both are same.
correct me if am wrong ?



Thanks and Regards,
Mahendra

On Mon, Apr 3, 2017 at 1:39 PM, Todor Velichkov <todorvelichkov89@gmail.com> wrote:
The first one will use a single JOIN on the entry table, and will apply both filters to that table.
The second one will JOIN the entry table twice, and for every join will apply only a single filter


On Sunday, April 2, 2017 at 5:41:29 PM UTC+3, Mahendra Gaur wrote:
Hello everyone,

I am newbie to django. Now-a-days am reading django docs.
While reading models i got confusion that, What is the difference between filter chaining and filter with multiple arguments.
For example what is the diffrence between below two:

Blog.objects.filter(entry__headline__contains='Lennon', entry__pub_date__year=2008)
Blog.objects.filter(entry__headline__contains='Lennon').filter(entry__pub_date__year=2008)

can some one please help me to understand how these both works and most importantly what will be corresponding MYSQL queries for above two statements ?



Thanks and Regards,
Mahendra

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/19f4e103-0325-4f8e-bd03-502a1f2fe002%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAExdeFbNanEPwgXCLuyuAMiA1XWPNVWGqvk%2BSnE8KxU67ExiZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment