我有一个表格,其中包含3列studentid
,qualification
和board
。
它显示像
Studentid - qualification - board
1 - highschool - cbse
1 - intermidiate - cbse
2 - highschool - up board
2 - intermidiate - up board
我需要一个提供结果的查询,如。
studentid - qualification-1 - qualification-2 - board-1 - board-2
1 - highschool - intermidiate - cbse - cbse
2 - highschool - intermidiate - up board - up board
任何人都可以解决它吗?
答案 0 :(得分:0)
SELECT studentid, qualification AS 'qualification-1', qualification AS 'qualification-2', board AS 'board-1', board AS 'board-2' WHERE 1 GROUP BY studentid
使用 AS 创建字段别名