select
t.file_id,
count(*) as num,
group_concat(t.xy, " ") as xy
from
(select
a.face_id as face_id,
b.[file_id] as file_id,
(a.feature_id || " " ||a.[x] || " "||a.[y]) as xy,
a.feature_id as feature_id
from Faces as b Left JOIN FeatureCoords as a
where a.face_id=b.face_id) as t
group by t.face_id;
t.file_id,
count(*) as num,
group_concat(t.xy, " ") as xy
from
(select
a.face_id as face_id,
b.[file_id] as file_id,
(a.feature_id || " " ||a.[x] || " "||a.[y]) as xy,
a.feature_id as feature_id
from Faces as b Left JOIN FeatureCoords as a
where a.face_id=b.face_id) as t
group by t.face_id;