Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need to show sales record for more than calender y

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2014-06-12 : 19:02:44
In the following code, we are looking to show all records, where,
the part# had no sales for the 2 month period selected by the user. But we also do not want to show this part if the current onhand balance is o, and also, we do want to show when was the last sale for this part. THe change i need is that the code here will show the last sales for past year only of calender year. I would like it to show 2 years back, meaning 2 full years from current date.
I think i need to have an OR statement here and {SUMPRT.IQYER#} = {?Year} but not really sure.


{PARTINV.IEQOH#} <> 0.00 and
(
if {?Month}=1 then
(({SUMPRT.IQA01} =0 and {SUMPRT.IQYER#} = {?Year}) and ({SUMPRT.IQA12} =0 and {SUMPRT.IQYER#} = {?Year}-1))
else

if {?Month}=2 then
({SUMPRT.IQA01} =0 and {SUMPRT.IQA02} =0 ) and {SUMPRT.IQYER#} = {?Year}
else

if {?Month}=3 then etc...
   

- Advertisement -