MySQL a query from two tables
1 1 I have 2 tables created with SQL. The first one has an unique id and a name of a provider. The second one has a product name, the amount of that product and the id of the provider. I need a query that gives me the name of each provider and the total sum of the product amount that they have. Ex: CREATE TABLE IF NOT EXISTS provider (id int unique auto_increment primary key, name char(50)); CREATE TABLE IF NOT EXISTS product (id int unique auto_increment primary key, name char(30), provider_id int NOT NULL, amount int NOT NULL); Provider: (id, name) 1 Mike 2 Peter 3 John Product: (id, name, provider_id, amount) 1 RedCar 1 100 2 BlueCar 1 50 3 RedCar 3 35 4 OrangeCar 2 500 5 GreenCar 3 250 Query: Mike 150 Peter 500 John 285 mysql share | improve this question edited Nov 13 '18 at 13:27 Madhur Bhaiya 19.6k 6 22 36 asked Nov 13 '18 at 13:01 Cristian Pacurar Cristian Pacurar 8 4 try this stackoverflow.com/question