I have the following query which gives me two columns
customer_count...one row per store.
SELECT a.id AS store,count(b.*) AS customer_count FROM stores a, customers b WHERE ST_DWithin(a.geom::geography,b.geom::geography,5000) GROUP BY a.id
This works perfectly.
What I need to add to this is another variable that represents the percentage of customers for each store. That is,
customer_count/total number of rows in customer table. I'm just not sure how to structure this.