Thanks Chandra and Sreehari but for the logic that I need to use, CASE wont work.
I have used CASE too for a different requirement and that works just fine.
If I get to know the exact IF syntax (not sure if it can be used in SELECT though) then I can use that to exactly use the logic I need.