James
James

Reputation: 71

Count data and eliminating duplication in SQL (ORACLE)

i have data in this table.

enter image description here ..... ....

so i want the output to look like table enter image description here

what is the SQL for that?

Upvotes: 0

Views: 41

Answers (1)

Gurwinder Singh
Gurwinder Singh

Reputation: 39497

Simple. GROUP BY and COUNT.

select
    customer_no,
    items,
    count(*) "COUNT"
from your_table
group by customer_no,
    items;

Upvotes: 3

Related Questions