on 01-27-2015 2:36 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrew,
Use Case Statement to get your requirement.
Hope this helps
--
--
Regards::::
Atul Chakraborty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.