Làm thế nào tôi sẽ làm các truy vấn sau đây:ON DISTINCT trong django
OrderNotes.objects.filter(item=item).distinct('shared_note')
Về cơ bản, tôi cần phải có được tất cả OrderNotes
mục, riêng biệt trên shared_note
. Khi tôi thử và làm điều này, tôi nhận được:
raise NotImplementedError('DISTINCT ON fields is not supported by this database backend')
NotImplementedError: DISTINCT ON fields is not supported by this database backend
Tôi đang sử dụng mysql và không thể thay đổi db tại đây. Điều gì sẽ là workaround trong django?
Bạn có thể gửi mô hình này? – Ngenator