Devi Prasad
11/24/2021, 8:16 AM`SELECT COUNT(g.id) AS 'total_used', s.`product_name`, s.`current_period_start` AS 'current_period_start', s.`current_period_end` AS 'current_period_end'
FROM `subscription` s
JOIN `user` u ON s.`customer_id` = u.`customer_id`
LEFT JOIN `goat` g ON g.`user_id` = u.`id` AND
g.`date_created` BETWEEN s.`current_period_start` AND s.`current_period_end`
WHERE u.`id` = "00000-00000" AND s.`status` = 'ACTIVE'
Ryan
11/24/2021, 8:26 AMRyan
11/24/2021, 8:27 AM