Please give out your table structure firstSuggest that you could use a join query and with group by