I have a query
allcategory = db.session.query(func.count(marketItem.subcategory).label("help"),Subcategories.subname1)
allcategory = allcategory.join(Subcategories)
allcategory = allcategory.filter(marketItem.subcategory == Subcategories.id)
allcategory = allcategory.filter(marketItem.vendor_id==vendorprofile.id)
allcategory = allcategory.group_by(marketItem.id)
for allcat in allcategory.all():
print(allcat)
thats outputs the results as
(1, 'Consoles')
(1, 'Consoles')
(1, 'Paintings')
(1, 'Paintings')
(1, 'Paintings')
I would like them to be
(2, 'Consoles')
(3, 'Paintings')
If it could also be explained in regular sql terms, that would help as well.