Hi,I've got the following schemaarea-------------idarea_namecompany_area--------------------area_idcompany_idcompany--------idcompany_namecompany_sector---------------sector_idcompany_idsector------idsector_name
What I'm trying to acheive is a report which counts the number of companies in each sector & area e.g. area1 area2 area3 ...sector1 5 1 2 ...sector2 0 3 2 ...sector3 9 38 1 ...... ... ... ... ...
Because the sectors & areas change often I'm a bit stuck as to the best way to acheive this - the only thing I can think of is to do a temporary table and cursor through all the areas & sectors getting the unique pairs and doing a seperate update to calculate the count. So you end up with a table like:area_id sector_id company_count---------------------------------1 1 51 2 01 3 92 1 12 2 3... ... ...
Does anyone have any better ideas of how to acheive this?In case it matters - its not huge amounts of data currently theres about 50 areas & sectors and about 10,000 companies (although the amount of company data is likely expand a lot)ThanksLuke