I've setup a few tables to represent different products as some products have different attributes to others.
I am trying to do a count of how many items are listed from a specific city. My sql statement is as follows:
Select count(*) as count from location, tbl_books where location.city = tbl_books.location && location.city = 'London' && location.country = 'United Kingdom'
Select count(*) as count from location, tbl_clothes where location.city = tbl_clothes.location && location.city = 'London' && location.country = 'United Kingdom'
This loops to count results in all cities within the country. These loops represents the inner loop. The outer loop loops through the different category tables.
I find this is not very efficient and was wondering whether anyone might be able to suggest any way of dealing with this problem. I was thinking of just creating a master table with cities and category fields and just incrementing the count in the master table everytime a new item is added from a particular city.