please i have two columns-col1 and col2, col1 contain item and col2 contain the quantity of the item
col1 col2 Key 4 Soap 5 seat 4 Key 3 Soap 4
how will i query the database to sum the Items and display output so that it will be like this col1 col2 Key 7 Soap 9 Seat 4
hi friend, use MySQL(group by) keyword to solve your problem. Here I am giving a sample SQL query hope this will helpful for you.
select item, sum(quqantity) from `order` group by item
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.