In Sybase version 12.5.1 the select statement as attached throws error but in Sybase 12.5.3 version it runs fine.
I further checked and saw that when I comment below line :-
AND exists(select 1 from zzzzzz c where td.something_cd=c.somethin
g and td.something2 between c.something4StartRange and c.something4EndRange)
and run the query in 12.5.1 it runs fine. I think it is version issue .can you please confirm this and with some detail ( any sybase bug link) then it will be really great. a quick answer is highly appreciated.