MySQL: Sum if rows are equal I have a table with 4 columns: Client , thickness , material and amount.

I want to make a SQL select-query to select everything, but when the client, thickness and material are the same their value of 'amount' should be added.

How would I go about creating such a query?
This is straightforward (a simple GROUP BY):

SELECT Client, thickness, material, SUM(amount) as amount
FROM your_table
GROUP BY Client, thickness, material;


Change your_table for the name of your table. If only 1 row exists of one combination of Client, thickness and material, it will select it as is.

Check the GROUP BY MySQL page for more information.