I have a database (mysql) with two tables, one for categories and one for photos.
Not all categories have photos, but the ones with photos are marked in the categories table with a flag photo=yes. There is also a flag for the domestic categories, which are the ones I'm interested in here. The Photos have grades from 1-10.
What I want to do is to rank the categories flagged domestic=yes with the worst photos (so I know what to improve). Since there are 700 categories and about 7.000 photos, it would be nice to search. :-)
Categories Table
ID Category_name Photo Domestic
1 CatA yes yes
2 CatB yes yes
3 CatC yes yes
4 CatD yes no
5 CatE no yes
Photo table
ID Cat_ID Grade
1 1 4
2 1 4
3 1 5
4 2 6
5 2 6
6 3 4
7 3 4
8 3 3
9 4 2
So the result from my search I would like to get is the domestic=yes categories that have photo=yes ranked by category with the worst best pic:
Category: Grade:
CatC 4
CatA 5
CatB 6
I hope I have been clear, this would really help me, so I'm looking forward to your solutions. :-)
Thanks in advance!