Find the emails of customers who has filed a complaints of the product with the most complaints.
CREATE TABLE customers (email_address VARCHAR, customer_id VARCHAR); CREATE TABLE complaints (customer_id VARCHAR)
SELECT TOP 1 t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (email_address VARCHAR, customer_id VARCHAR); CREATE TABLE complaints (customer_id VARCHAR) Question: Find the emails of customers who has filed a complaints of the product with the most complaints. [/INST] SELECT TOP 1 t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) </s>