-3

I have a SQL table which mentions stock quantity like this:

Tool: Stock
A: 100
A: 200
B: 50

I want to create a view where it will give me the following output, where it would count the sum of same tool numbers:

Tool: Stock
A: 300
B: 50

How to achieve this? Thanks in advance :)

1 Answers1

0

Try the below -

create view view_name as
    select tool, sum(stock)
    from tablename
    group by tool
Fahmi
  • 37,315
  • 5
  • 22
  • 31