Modified SQL query to create _map table by adding a WHERE clause and removing the ORDER BY