Running a SQL query from specific month in SAP DB



When your T0.name is char filed, you should replace Order By as below −

order by
case when cast(left (T0.Name,2) as int)>=8
   then cast(left (T0.Name,2) as int)-8
   else cast(left (T0.Name,2) as int)+4
 end

Advertisements