I´m trying to excecute a simple left join on SQL Server but it keeps getting me the same message.
Select * from customers left join orders on customers.id = orders.customer_id group by customers.id order by amount;
Msg 8120, Level 16, State 1, Line 39 Column 'customers.first_name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I´m not sure what else to do. If it helps, here there are my tables:
CREATE TABLE customers(id INT IDENTITY(1,1) PRIMARY KEY, first_name VARCHAR(100), last_name VARCHAR(100), email VARCHAR(100));
CREATE TABLE orders(id INT IDENTITY(1,1) PRIMARY KEY, order_date DATE, amount DECIMAL(8,2), customer_id INT, FOREIGN KEY(customer_id) REFERENCES customers(id));