Are you able to provide DDL, sample data and desired output, as per the link in my signature?
Can I also suggest that you read up on column aliases - it might make things more readable.
So instead of
select reallylongtablename.col1, reallylongtablename.col2
from dbo.reallylongtablename
you get
select t1.col1, t2.col2
from dbo.reallylongtablename t1
and the icing on the cake is to surround the T-SQL with IFCode tags:
select t1.col1, t2.col2
from dbo.reallylongtablename t1
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.