Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Assistance needed to modify SQL query to show data more 'user friendly'

Hi experts

I have

Select DateDiff(dd,GetDate(), T1.U_NxtVisitDue) AS 'Overdue'

This displays x number according to whether a visit to a customer is due in x days (positive number) or overdue in x days (negative number)

I want to display nothing (blank cell) if visit is not yet due and only display a figure when a visit is overdue .. and I want the figure to be displayed as a positive number instead of a negative number.

Would be grateful for help how to modify my select statment to display as above reqirement?

Regards,

Karen

Former Member
Former Member replied

Hi

You may try:

Select -DateDiff(dd,GetDate(), T1.U_NxtVisitDue) AS 'Overdue'

FROM XXXX T1

Where DateDiff(dd,GetDate(), T1.U_NxtVisitDue) < 0


or:


Select DateDiff(dd, T1.U_NxtVisitDue,GetDate()) AS 'Overdue'

FROM XXXX T1

Where DateDiff(dd,GetDate(), T1.U_NxtVisitDue) < 0



Thanks,

Gordon

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question