| Author |
Topic  |
|
|
reedallenbrown
Starting Member
USA
2 Posts |
Posted - 01/12/2013 : 12:07:17
|
I just can't seem to figure this out. I'm trying to get the number of days between two fields. Field one is named "startofcare" and field two is named "dischargeddate". Using the formula below works fine unless the discharge date is blank meaning the Patient has not left service yet. I still need to know the date difference from the startofcare to today. can I do both in one formula?
(datediff(day,[startofcare],[dischargedate]))
I thought I could use (datediff(day,[startofcare],[dischargedate])) .OR. (datediff(day,[startofcare],GETDATE))
but that does not work.
Any idea's????
Thanks so much for the help. |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47189 Posts |
Posted - 01/12/2013 : 12:33:06
|
datediff(day,[startofcare],COALESCE(NULLIF([dischargedate],''),GETDATE()))
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
reedallenbrown
Starting Member
USA
2 Posts |
Posted - 01/12/2013 : 12:53:50
|
| Thank you so much that worked !!!!! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47189 Posts |
Posted - 01/12/2013 : 12:57:24
|
welcome
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|