tortoise-orm
tortoise-orm copied to clipboard
how to realize count and distinct together?
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context about the feature request here.
I want to execute the below sql:
select count(*) from (SELECT DISTINCT `students_id`, `subject_id`, `school_id`
FROM `user_item_score`
WHERE `deleted` = 0
AND `score_type` = 2
AND `score_year` = '') a;
so, how to do with the orm? I try it with Concat and Subquery,but failed.
Could you please provide your models ?