troubleshooting Question

group by period

Avatar of fiore45
fiore45 asked on
Microsoft SQL ServerMicrosoft SQL Server 2008
13 Comments1 Solution637 ViewsLast Modified:
Hi EE,

I need to write a query that group by according to 3 days period in a month. As an example;

There are phone numbers and date_called fields in a table. I want to query duplicate phone numbers which in 3 days interval.  

phone_number     called_date

xxx yyyyyyy        2011-08-01
xxx yyyyyzz        2011-08-01
xxx yyyyzzz        2011-08-02
xxx yyyyyyy        2011-08-03
xxx yyyyyyy        2011-08-05
xxx yyyyyyy        2011-08-12

My query should appear following,

Number               Count
xxx yyyyyyy        2

Thank you.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros