如何在列的Similer值上拆分列基础。 [英] How Can I Split A Column Bases On Similer Values Of Column.
问题描述
SIR,我有一个表格,其中有3列学生,资格和董事会。
它表现得像......
学历 - 资格 - 董事会
1 - highschool - cbse
1 - intermidiate - cbse
2 - highschool - up board
2 - intermidiate-up board
i需要一个给出结果的查询...
studentid - 资格 - 1 - 资格 - 2 - 板-1 - 板-2
1 - highschool - intermidiate - cbse - cbse
2 - highschool - intermidiate-up board-up董事会
可以解决任何问题..
您只需要为每一行指定一个唯一的ID。然后你可以这样做:
选择t1.studentid,
t1.Qualification as qualification1,
t2.qualification作为qualified2,
t1.board作为board1,
t2.Board作为board2
来自TestSQB t1内部加入
TestSQB t2 on t1.studentid = t2.studentid
and t1.uniqueid< t2.uniqueid
SIR, i have a table in which 3 columns studentid,qualification and board.
it show like....
Studentid - qualification - board
1 - highschool - cbse
1 - intermidiate - cbse
2 - highschool - up board
2 - intermidiate - up board
i need a query that give result like...
studentid - qualification-1 - qualification-2 - board-1 - board-2
1 - highschool - intermidiate - cbse - cbse
2 - highschool - intermidiate - up board - up board
can any one solve it..
You just need to give each row a unique id. Then you can do this:
select t1.studentid, t1.Qualification as qualification1, t2.qualification as qualification2, t1.board as board1, t2.Board as board2 from TestSQB t1 inner join TestSQB t2 on t1.studentid = t2.studentid and t1.uniqueid < t2.uniqueid
这篇关于如何在列的Similer值上拆分列基础。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!