Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Counting distinct periods of consecutive days

By Harsha Majety,

My friend gave me an interesting problem yesterday. He works for a hospital and needs to count patient visits, and if a patient visits the doctor on consecutive days, it needs to be counted as 1 visit. Here is how i solved it. This is just one of many ways to do it.

Total article views: 1914 | Views in the last 30 days: 4
Related Articles

Visiting Atlantis

This week I got to visit Atlantis. Not the mythical island, but rather the ship, the Space Shuttle A...


Blog Changes on & Visiting The IndyTechFest

Perhaps you've noticed a few of the blog changes if you visit via the web rather than RSS. One good....


Visiting West Palm Beach SQL Group on April 29, 2009

I'm going to West Palm Beach on Apr 29th to visit Scott Klein and his group. I'll be doing a...


how to calculate duration spent on every visit

I have to show sessionID PageId Duration spent for a page visit


Visiting the Charlotte SQL User Group on Feb 27th

I'll be visiting the Charlotte SQL Group on Feb 27th and I'll be doing one of my favorite presentati...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones