我有以下代码
它生成了一个计数,显示了在图像1中有多少女性使用了“出租车”和“斑马线”的词根。
样本数据
select count(*)
from (select Annotations.user_id
from Annotations, Users
where Users.gender = 'Female'
and Users.user_id = Annotations.user_id
and image_id = 1
group by Annotations.user_id
having sum(case when stem = 'taxi' then 1 else 0 end) > 0 and
sum(case when stem = 'zebra crossing' then 1 else 0 end) > 0
) Annotations
它生成了一个计数,显示了在图像1中有多少女性使用了“出租车”和“斑马线”的词根。
样本数据
user id, image id, stem
1 1 image
1 1 taxi
1 1 zebra crossing
2 1 person
2 1 zebra crossing
2 1 taxi
3 1 person
3 1 zebra crossing
期望结果(或类似结果)
stem1, stem2, count
taxi , zebra crossing 2
person, zebra crossing 2
然而,由于有超过2000个词干,我无法全部指定。
如果不是指定词干字符串,我该如何循环遍历带有image_id = 1和gender = female的词干行?
谢谢
stem
属于哪个表? - PM 77-1