Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Expression Causes Crystal to Freeze

Status
Not open for further replies.

dleewms

Programmer
Aug 19, 2001
118
0
0
US
I am using Crystal XI on SQL Server. I've created an SQL Expression to get the sum of sub_amts for last year to date. However, every time I save it, Crystal freezes. Anyone have any suggestions and what I can do to resolve this issue? Thanks!

(
select sum(ivc2."sub_amt")
from invoice ivc2
join sales_register
on ivc2."customer_id" = "sales_register"."customer_id"
where ivc2."invoice_date" BETWEEN
DateAdd(yyyy, DateDiff(yyyy, 365, GetDate()), 0)
and DateAdd(dd, DateDiff(dd, 365, GetDate()) +1, 0)
)



 
I responded to your original post, and I think your use of yyyy with 365 was the problem.

-LB
 
You are correct. The change from 365 to 1 in the following line of code resolved the issue. I'll close this one out and give you credit for its resolution.

DateAdd(yyyy, DateDiff(yyyy, 365, GetDate()), 0)

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top