What is the customer last name, id and phone number with most number of orders?
CREATE TABLE Orders (customer_id VARCHAR); CREATE TABLE Customers (customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR)
SELECT TOP 1 T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Orders (customer_id VARCHAR); CREATE TABLE Customers (customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR) Question: What is the customer last name, id and phone number with most number of orders? [/INST] SELECT TOP 1 T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC </s>