如何在列的Similer值上拆分列基础。 [英] How Can I Split A Column Bases On Similer Values Of Column.

查看:68
本文介绍了如何在列的Similer值上拆分列基础。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆