please i have two columns-col1 and col2, col1 contain item and col2 contain the quantity of the item
columns and their corresponding quantity: cup 4, Soap 5, seat 4, cup 3, Soap 4
how will i query the database to sum the Items and display output so that it will be like this Cup 7, Soap 9, Seat 4.
hi friend, You can use the (group by) SQL keyword to solve your problem. Here I am giving the SQL query against your question what you have asked.
select item, sum(quqantity) from `order` group by item
Here item, and quantity are columns and order is a table.