I have 7200 rows of 29 users who attended unique request tickets in 10 different categories.
Out of them, I need to select N records for each and every Users.
Conditions :
-
Out of N, 40 % rows should be those of a category X, Lets say Editorial.
-
Remaining 60 % rows should be those using other than Category X
Using sqlite, I handled so far by trying 'DISTINCT' but is there a way to achieve the above?
select distinct * from report
where category <> 'Editorial'
and
name in (select distinct name from report)
GROUP By name
LIMIT (select count(distinct name) from report)
edit : I'm using python for rest of all the above operations. As its a large data, I preferred sqlite. If there's a way in python, I'm okie to learn about it.
Aucun commentaire:
Enregistrer un commentaire