0

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?

3
  • 1
    Look up for Count aggregate and Group by clause Commented Jan 21, 2017 at 16:47
  • Please post data as formatted text, not screenshots. Also, what have you tried so far? Commented Jan 21, 2017 at 16:50
  • Possible duplicate of MySQL: Group By & Count Multiple Fields Commented Jan 21, 2017 at 16:55

1 Answer 1

3

Simple. GROUP BY and COUNT.

select
    customer_no,
    items,
    count(*) "COUNT"
from your_table
group by customer_no,
    items;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.