--
I just developed some code like:
MyModel.objects.filter(key_to_mymodel2 = MyModel2.objects.all()))
This query produce SQL:
SELECT * FROM `test_mymodel` WHERE key_to_mymodel2_id =(select `id`
from `test_mymodel2`)
It works fine on SQLLite, but in MySQL it produce error:
OperationalError: (1242, 'Subquery returns more than 1 row')
MySQL to work need query:
SELECT * FROM `test_mymodel` WHERE key_to_mymodel2_id = ANY (select
`id` from `test_mymodel2`)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=.
I don't fully understood your question. Of course I have more than one row at test_mymodel2SQL query was formed by django-ORM. I just callprint (MyModel.objects.filter(key_to_mymodel2 = MyModel2.objects.all()))._as_sql())and write here output.