select
'http://gaming.stackexchange.com/questions/' + case when isnull(p.parentid,'')='' then cast(p.id as varchar) else cast(p.parentid as varchar) end + '#comment' + cast(c.id as varchar) + '_' + cast(p.id as varchar),
c.score,
c.text
from comments c
inner join posts p on c.postid = p.id
where c.userid = ##userid## and c.creationdate > (getdate() - 365)
order by c.score asc