select attrid,attrcomm,
max(case attrid when 1 then 'comment1' else 0 end) comment1,
max(case attrid when 2 then 'comment2' else 0 end) comment2
from attribute_table
where attrtype = 'hobby'
group by attrid,attrcomm
since attrid is a varchar and not an integer I get the error message Conversion failed when converting the varchar value to data type int
I am trying to show comment1 horizontally next to comment2 so I tried a case statement. So I want to show the distinct attrid with the comments side by side
example
attrid comment1 comment2
1222 hiking fishing
max(case attrid when 1 then 'comment1' else 0 end) comment1,
max(case attrid when 2 then 'comment2' else 0 end) comment2
from attribute_table
where attrtype = 'hobby'
group by attrid,attrcomm
since attrid is a varchar and not an integer I get the error message Conversion failed when converting the varchar value to data type int
I am trying to show comment1 horizontally next to comment2 so I tried a case statement. So I want to show the distinct attrid with the comments side by side
example
attrid comment1 comment2
1222 hiking fishing