The sql is:
select id from tableA where MOD(id,10)=1
database is mysql. How to covert this sql to django orm filter?
The sql is:
select id from tableA where MOD(id,10)=1
database is mysql. How to covert this sql to django orm filter?
You can make use of the % operator:
from django.db.models import F
MyModel.objects.annotate(
id10=F('id') % 10
).filter(
id10=1
)