On Feb 4, 6:23 am, äL <lamberto.gri...@gmail.com> wrote: > I have an SQL statement in views.py: > > karatekas = Karateka.objects.extra(where = ["bsc = 1 OR skr = > 1"]).select_related() > > This statement runs in a loop an no data will come back. > > If I change the little word "OR" to "AND", > > karatekas = Karateka.objects.extra(where = ["bsc = 1 AND skr = > 1"]).select_related() > > the right data will show up. > > Why does it not work with "OR"?
What do you mean by 'runs in a loop'? I can't parse that sentence. What is the actual behaviour? Do you get an error? I'm not sure why you're doing this in SQL, anyway. This can be done directly in the ORM: Karateka.objects.filter(Q(bsc=1) | Q(skr=1)).select_related() -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.