Preview:
SELECT customers.id, ROUND((DATEDIFF(customers.last_order_date, pc_since)/30), 1) AS "active months", customers.last_order_date, IF(customers.last_order_date <= "2021-09-20", "inactive", "active") AS "activity", customer_addresses.state, IF(customers.gender >= 0, customers.gender, "") AS "gender", IF(customers.birthday IS NOT NULL, ROUND(DATEDIFF("2021-10-22", customers.birthday)/365, 0), "") AS "age", IF(customers.init_promocode IS NULL, "", IF(customers.init_promocode = "FOX NEWS", "FOXNEWS", customers.init_promocode)) AS "promo code", customers.number_hc_consults
 
FROM customers INNER JOIN customer_addresses ON customers.default_address=customer_addresses.id
WHERE pc_since IS NOT NULL AND last_order_date IS NOT NULL AND ROUND((DATEDIFF(last_order_date, pc_since)/30), 1) > 0.5 AND customers.flag_testing <> 1 AND (customers.birthday > "1800-01-01" OR customers.birthday IS NULL)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter