2
我想要查詢的SQL像這樣在Django查詢凡在Django
select auth_group.name auth_user.username
from auth_group, auth_user, auth_user_groups
where auth_user.id = auth_user_groups.id AND auth_group.id = auth_group.id AND auth_group.name = "Operator";
表:
auth_user -> id, username
auth_group -> id, name
auth_user_groups -> id, user_id, group_id
和我嘗試查詢在Django這樣
p = User.objects.all().prefetch_related('groups').get(groups='Operator')
但錯誤ValueError: invalid literal for int() with base 10: 'Operator'
你可以幫我解決這個問題`
好,謝謝工作:) – User0511