开发者

How do I do mysql "LIKE" in django?

开发者 https://www.devze.com 2023-02-11 06:59 出处:网络
SELECT * from m开发者_开发百科yapp_mymodel WHERE code LIKE \"914%\";I would recommend reading the manual, it clearly tells you how to do this: http://docs.djangoproject.com/en/dev/ref/models/querysets

SELECT * from m开发者_开发百科yapp_mymodel WHERE code LIKE "914%";


I would recommend reading the manual, it clearly tells you how to do this: http://docs.djangoproject.com/en/dev/ref/models/querysets/#startswith

MyModel.objects.filter(code__startswith='914')
0

精彩评论

暂无评论...
验证码 换一张
取 消