Map View for all finds, by geoLocation

map    In the SO 100km grid square
GB map - so area query error: CREATE TEMP TABLE temp (county varchar(20), findspot varchar(50), n numeric, grid_let varchar(2), grid_e integer, grid_n integer); INSERT INTO temp ( SELECT a.county,b.findspot,COUNT(distinct d.refid) AS n,b.grid_let,b.grid_e,b.grid_n FROM tbl_county a JOIN tbl_findspot b ON a.county = b.county JOIN tbl_excavations c ON b.findspot = c.findspot JOIN tbl_assoc_finds d ON c.excavation = d.excavation AND d.class != 'No records' WHERE b.grid_let = 'SO' GROUP BY a.county, b.findspot,b.grid_let,b.grid_e,b.grid_n UNION SELECT a.county,b.findspot,COUNT(distinct e.vessel_no) AS n,b.grid_let,b.grid_e,b.grid_n FROM tbl_county a JOIN tbl_findspot b ON a.county = b.county JOIN tbl_excavations c ON b.findspot = c.findspot JOIN tbl_contexts d ON c.excavation = d.excavation JOIN tbl_vessels e ON d.context = e.context AND d.excavation = e.excavation WHERE b.grid_let = 'SO' GROUP BY a.county, b.findspot,b.grid_let,b.grid_e,b.grid_n UNION SELECT a.county,b.findspot,COUNT(distinct e.refid) AS n,b.grid_let,b.grid_e,b.grid_n FROM tbl_county a JOIN tbl_findspot b ON a.county = b.county JOIN tbl_excavations c ON b.findspot = c.findspot JOIN tbl_contexts d ON c.excavation = d.excavation JOIN tbl_quant_gb e ON d.context = e.context AND d.excavation = e.excavation WHERE b.grid_let = 'SO' GROUP BY a.county, b.findspot,b.grid_let,b.grid_e,b.grid_n ); SELECT findspot,county,grid_let,grid_e,grid_n FROM temp GROUP BY findspot,county,grid_let,grid_e,grid_n HAVING SUM(CASE WHEN n > 0 THEN n ELSE 0 END) > 0 ;