SQLite Forum

request on 5 tables
Login
You have two distinct problems.

Problem one: Merging the content of the 5 Stores' data.
Problem two: Finding customers that visit more than one store.

For problem one:

You need a schema that is common to all the stores and the central location. And you need a method to record the changes made at each store to replicate them to central and all other stores (for customer identification).

In the table recording the visits, add a column storeID and assign astoreID to each store. That way you can copy the changes from all the stores into a single table.

For problem two:

SELECT customerID, count() as stores_visited from (SELECT DISTINCT customerID, storeID FROM visits) GROUP BY customerID HAVING stores_visited = 5;