Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Range Post Reply Post New Topic
Author Message
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Topic: Date Range
     Posted: 04 Jul 2012 at 12:25am

Hello, I have a question about date ranges.

 

If i use

ADDEDDATE in today to today-6

or ADDEDDATE in today to DATEADD("d",-6,today)

 

vs

 

ADDEDDATE in  today-6 to today

or ADDEDDATE in  DATEADD("d",-6,today) to today

 

I get very different numbers / records.

 

Why does it matter if the earlier date comes first or second?

 

I assume ADDEDDATE in today to DATEADD("d",-6,today) would be the correct option?

 

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Jul 2012 at 2:21am
(today-6) to today
Is the correct syntax.
IP IP Logged
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Posted: 04 Jul 2012 at 2:36am
Are you able to explain why the other way doesn't work though?
 today to today-6? still returns records, just not all of them.
Dont understand why it would matter which way the range was, the dates are still the same. Is this a crystal thing? or SQL? that causes this to happen?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Jul 2012 at 4:50am
I have not tested it but my guess is that when you inverted it it only counted records for today.
I think it wants to 'count up'.
If you use a datediff() function and invert the dates you will get a negative value so I would guess it is a similar sort of thing.

Edited by DBlank - 04 Jul 2012 at 4:51am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum