I have a query. Its working fine on sqlite server but not working fine
on mysql server.
This is the error message on mysql server: "This version of MySQL
doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery"
This is the query:
inner_q = obj_unassigned.values_list('pk', flat=True)[:diff]
total_objects = (obj_assigned | obj_class.objects.filter(pk__in=inner_q))
Any help appreciated on how to fix this.
Thanks.
RJ
On 26/01/12 20:10, rahul jain wrote:
> All,
>
> I have a query. Its working fine on sqlite server but not working fine
> on mysql server.
>
> This is the error message on mysql server: "This version of MySQL
> doesn't yet support 'LIMIT& IN/ALL/ANY/SOME subquery"
>
> This is the query:
>
> inner_q = obj_unassigned.values_list('pk', flat=True)[:diff]
> total_objects = (obj_assigned | obj_class.objects.filter(pk__in=inner_q))
>
> Any help appreciated on how to fix this.
>
> Thanks.
>
> RJ
>
You can prevent the error by using `list()` to fetch the inner queryset
in a separate query:
total_objects = (obj_assigned | obj_class.objects.filter(pk__in=list(inner_q)))
Alasdair
--
Alasdair Nicol
Developer, MEMSET
mail: alas...@memset.com
web: http://www.memset.com/
Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, Surrey, GU2 7YD, UK.
> --
> 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=en.
>