How can extract all possible values of one field and their corresponding description form a table?

Here is an example table:


I just want to aggregate all similar values. can you help me with SQL Script?

please provide your sample data not as an image (we cannot query an image) but as proper DDL and DML

create table #sample(code int, description nvarchar(10))

insert into #sample
Slect 0, 'AAA' union
select 1, 'BBB'

for the whole data set

Hope this helps

select 
   description , count(*) 
from 
  TABLE
group by 
  description 

image

Sorry seems like I was not clear. What I want to do is not something pivot table does in excel. I actually have a big table in database and what I want to do is to get to know what are all different values possible for a code for example or at least all the available values in the table. When I do not know what are the possible value I cannot find the related table that has those values stored in it.

Maybe?:

SELECT DISTINCT code, description
FROM table_name
ORDER BY code, description