本文介绍了我必须在财政年度的基础上设定条款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 请帮助我如何根据财政年度设定条件 选择前25名O.OCSEmployeeCode作为UserID,OCSBillNo as BillNo,转换(varchar(10),OCSBillDate,103)为BillDate,Year(OCSBillDate)为mYear,DATEPART(mm,OCSBillDate)为mMonth 来自HMS_OCSBill O,其中OCSCancelStatus为空并且OCSDiscontinueFlag为空且O.OCSEmployeeCode ='GAA6725' AND(情况下DATEPART(mm,getdate())< 4 THEN ((年(OCSBillDate)=年(getdate()) - 1和DATEPART( mm,OCSBillDate)> = 4))OR((年(OCSBillDate)=年(getdate())和DATEPART(mm,OCSBillDate)< = 3)) ELSE ((年( OCSBillDate)=年(getdate())和DATEPART(mm,OCSBillDate)> = 4))END)年订单(OCSBillDate)DESC; 它给我的错误信息是=附近的syntex。 我尝试了什么: 请帮忙我该如何解决.. .. div class =h2_lin>解决方案 please help how can i set a condition on the basis of financial yearSelect top 25 O.OCSEmployeeCode as UserID, OCSBillNo as BillNo, convert(varchar(10),OCSBillDate,103) as BillDate, Year(OCSBillDate) as mYear, DATEPART(mm,OCSBillDate) as mMonthfrom HMS_OCSBill O where OCSCancelStatus Is Null And OCSDiscontinueFlag Is Null and O.OCSEmployeeCode='GAA6725' AND (CASE WHEN DATEPART(mm,getdate())<4 THEN ((Year(OCSBillDate)=year(getdate())-1 AND DATEPART(mm,OCSBillDate)>=4)) OR ((Year(OCSBillDate)=year(getdate()) AND DATEPART(mm,OCSBillDate)<=3))ELSE((Year(OCSBillDate)=year(getdate()) AND DATEPART(mm,OCSBillDate)>=4)) END) ORDER BY Year(OCSBillDate) DESC;Its giving me error message that incorect syntex near "=".What I have tried:Please help how can i resolve it.. 解决方案 这篇关于我必须在财政年度的基础上设定条款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-18 02:34