Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jeff06
Posting Yak Master
166 Posts |
Posted - 2009-08-07 : 11:38:05
|
| tablepatientid firstdateofsvc lastdateofsvc 1 4/1/2008 4/1/20081 4/1/2008 4/2/20081 4/1/2008 4/6/20081 4/2/2008 4/3/20081 4/2/2008 4/5/20081 4/7/2008 4/7/20081 4/9/2008 4/9/20081 4/9/2008 4/9/20081 4/21/2008 4/22/20081 4/23/2008 4/25/20082 4/21/2008 4/22/20082 4/22/2008 4/25/2008expected retpatientid firstdateofsvc lastdateofsvc admission1 4/1/2008 4/1/2008 11 4/1/2008 4/2/2008 11 4/1/2008 4/6/2008 11 4/2/2008 4/3/2008 11 4/2/2008 4/5/2008 11 4/7/2008 4/7/2008 1 --because 4/7 next to 4/61 4/9/2008 4/9/2008 2 -- 4/9 is not next to 4/71 4/9/2008 4/9/2008 21 4/21/2008 4/22/2008 31 4/23/2008 4/25/2008 32 4/21/2008 4/22/2008 12 4/22/2008 4/25/2008 1this is medical claim data. I want to find how many hospital admissions a patient have and how many days a patient stay in hospital. The assumption is a patient who stay in hospital should have continuous calims.For example for patientid 1 has claims from 4/1 to 4/7 every day. it is consider 1 admission. In 4/8, no claim.but in 4/9 there is a claim. it is cosidered another admission. I spend two days but not able to find a solution. Can anyone kindly give me a hint on how to solve this problem?Thanks.Jeff |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
|
|
|