SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to look at data a year back
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AdamWest
Constraint Violating Yak Guru

USA
348 Posts

Posted - 12/02/2013 :  18:35:57  Show Profile  Reply with Quote
This formula "

if {ICDET76.ITTRND}>= {?S1 From Date} and {ICDET76.ITTRND}<={?S1 To Date} then

s1qty:= s1qty + {ICDET76.ITQTY#}; "



shows the qty used for an item corresponding to the month param entered.



In a new report, I need to show what was qty used for the item, but one year ago from that param date. What would be the way to calculate, in this formula. Param will stay the same. The user will enter 092013 and we want to show data for 092012, using above query which does work. just need to subtract a year. I tried sub 365 but this does not work.

which i would use in the new report?

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/03/2013 :  00:24:07  Show Profile  Reply with Quote
is this sqlserver? I dont think posted code is in T-SQL syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

USA
348 Posts

Posted - 12/03/2013 :  09:14:55  Show Profile  Reply with Quote
It's crystal reports but i believe they are based on sql server.

quote:
Originally posted by visakh16

is this sqlserver? I dont think posted code is in T-SQL syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/03/2013 :  09:26:14  Show Profile  Reply with Quote
quote:
Originally posted by AdamWest

It's crystal reports but i believe they are based on sql server.

quote:
Originally posted by visakh16

is this sqlserver? I dont think posted code is in T-SQL syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs





The code you posted is not a SQL Server query code
it might be crystal report expression in which case you may be better off posting it in some crystal report forums

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000