I asked this question yesterday on how to calculate the number of customers in a grid square, and the solution I got was:
SELECT 10 * (customer_x / 10), 10 * (customer_y / 10), COUNT (*) FROM t_customer GROUP BY customer_x / 10, customer_y / 10 ORDER BY 3 DESC;
Now I need to present the grid squares that contain zero customers, and I'm not sure how to do this as the query is based on calculations of the usual numbers and the grid doesn't actually exist in the table. Should I use an ISNULL() function? The results for this query in my current database are:
90|90|7
30|20|4
-20|-40|2
-10|-20|2
-10|-10|2
-40|-40|1
-40|-30|1
-40|30|1
-30|0|1
-20|0|1
-20|30|1
-10|-30|1
-10|40|1
0|-20|1
0|-10|1
0|0|1
0|10|1
0|40|1
10|20|1
20|20|1
30|-40|1
30|30|1
But given that there are 100 grid squares in the area there are many without customers. I just need a query that will show all but the above grid squares. I'm using SQLite3 and any help would be greatly appreciated. Those in the (90,90) grid square are to be ignored.
Sample data:
I need to have a list of grid squares with no customers in from the 100 grid squares in a 10 x 10 grid (-50 to +50 in increments of 10). It may be easier to use a virtual table of all possible grid squares and to subtract the above query from it?