Santiago Moresi

Generation

text to sql syntaxThu, 06 Jul 2023

Del total de clientes que realizaron compras en 2019 ¿Qué porcentaje lo hizo en al menos dos sucursales? Tabla 'cliente', 'compra'

SELECT (COUNT(DISTINCT(cliente_id)) * 100) / (SELECT COUNT(DISTINCT(cliente_id)) FROM compra) AS 'Porcentaje que hizo compras en al menos 2 sucursales' FROM compra GROUP BY cliente_id HAVING COUNT(DISTINCT(sucursal_id)) > 1;

Want to kickstart your project?Use the new AI Studio to create your code