如何显示同一个表中的数据 [英] how to show the data from the same table

查看:75
本文介绍了如何显示同一个表中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请一些人告诉我如何从一个表中获取值,就像我有字段....



 id姓名juniormanagerid seniormanagerid 
1 sachin 2 1
2 dhoni 4 1
3 rena 2 2
4 Malik 3 3
5 suraj 4 2









请一些人告诉我如何获取juniormanagerid和seniormanagerid的数据。



我不知道解决方案请帮助......



代码块添加 - OriginalGriff [/ edit]

解决方案

如果您要显示层次结构(A由B管理,B由C管理),那么本文概述了可用的工具在许多数据库中使用:



SQL中的递归 - 维基百科



这个链接显示了如何解决类似的(我认为)问题:



Stack Overflow上的示例答案

Pls some one tell that how to fetch the values from one single table like i have fields....

id    name       juniormanagerid   seniormanagerid
1     sachin          2                   1
2     dhoni           4                   1
3     rena            2                   2
4     Malik           3                   3
5     suraj           4                   2





Pls some one tell that how to fetch data of juniormanagerid and seniormanagerid.

I dont know the solution pls some one help......

[edit]Code block added - OriginalGriff[/edit]

解决方案

If you are looking to display the hierarchy (A is managed by B, B is managed by C) then this article outlines the tools available in a number of database enqines:

Recursion in SQL - Wikipedia

And this link shows how to solve a similar (I think) problem to yours:

Example answer on Stack Overflow


这篇关于如何显示同一个表中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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