WITH RECURSIVE job_categories AS (
    SELECT DISTINCT 
        CAST(JSON_EXTRACT(properties, '$.node_id') AS UNSIGNED) AS category_id,
        JSON_EXTRACT(properties, '$.node_id') AS node_id,
        created_at AS job_created_at
    FROM job_statuses
    WHERE id >= 9712
        AND type = 'best_seller'
        AND status != 'failed'
        AND JSON_EXTRACT(properties, '$.node_id') IS NOT NULL
)
SELECT 
    p.id AS product_id,
    jc.node_id
FROM products p
JOIN job_categories jc ON p.category = jc.category_id
WHERE p.created_at >= jc.job_created_at;