Santiago Moresi

Generation

text to sql syntaxThu, 06 Jul 2023

total de clientes del 2019, cual es el porcentaje lo hizo en al menos dos sucursales. Tablas 'clientes', 'compras'.

SELECT COUNT(DISTINCT(cedula)) AS DISTINCT_CUSTOMERS, (COUNT(DISTINCT(cedula))/COUNT(cedula))*100 AS PERCENTAGE_DISTINCT_CUSTOMERS FROM clientes INNER JOIN compras ON compras.cedula=clientes.cedula WHERE YEAR(fecha) = 2019

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