R
richardb
Here some code for a passthrough query:
SELECT f.category, c.FinanceClass, c.ProviderCode, PatDue,
PatDueCurrent =
Case DateDiff(day, service_date, GetDate())
WHEN 60 THEN PatDue ELSE 0 END,
PatDue60 =
Case DateDiff(day, service_date, GetDate())
WHEN 90 THEN PatDue ELSE 0 END
FROM uvwOpenCharges c JOIN FinanceClass f ON c.FinanceClass = f.FinanceClass ;
However, it's not what I really want. What I really want is for
PatDueCurrent to return Patdue when the DateDiff is LESS THAN 60. And I want
PatDue60 to return PatDue when the DateDiff is greater than or equal to 60
but less than 90. I have tried to use "<" operators but keep getting a syntax
error.
Can someone explain how to write my query please. Thanks...
SELECT f.category, c.FinanceClass, c.ProviderCode, PatDue,
PatDueCurrent =
Case DateDiff(day, service_date, GetDate())
WHEN 60 THEN PatDue ELSE 0 END,
PatDue60 =
Case DateDiff(day, service_date, GetDate())
WHEN 90 THEN PatDue ELSE 0 END
FROM uvwOpenCharges c JOIN FinanceClass f ON c.FinanceClass = f.FinanceClass ;
However, it's not what I really want. What I really want is for
PatDueCurrent to return Patdue when the DateDiff is LESS THAN 60. And I want
PatDue60 to return PatDue when the DateDiff is greater than or equal to 60
but less than 90. I have tried to use "<" operators but keep getting a syntax
error.
Can someone explain how to write my query please. Thanks...