Reputation: 1159
Hello I have a simple table like this:
name date
n1 d1
n1 d1
n2 d1
n3 d1
n1 d2
n2 d2
n2 d2
n1 d3
n1 d3
n1 d3
n4 d3
Where n# is some name and d# is some date. I need the following result:
name date number
n1 d1 2
n2 d1 1
n3 d1 1
n1 d2 1
n2 d2 2
n1 d3 3
n4 d3 1
What I'm doing is for each date, I count the number of times n# appears. Then I display for each name and date the number.
How can I do this on SQL? thank you
Upvotes: 0
Views: 51