select name,(case when strmonth='上月' then salary else NULL end ) as 'salary(上月)',(case when strmonth='上月' then code else NULL end) as 'code(上月)',(case when strmonth='本月' then salary else NULL end ) as 'salary(本月)',(case when strmonth='本月' then code else NULL end) as 'code(本月)' from test --group by name试验一下,应该可以,可以就给分喔
列名:
name salary code mdate就这几个字段