当前位置:网站首页>mysql查询当前节点的所有父级
mysql查询当前节点的所有父级
2022-07-24 07:08:00 【寻墨roy】
SELECT t2.file_id,t2.ffile_id
FROM
(
SELECT
@r AS _id,
( SELECT @r := xxx.file_info.ffile_id FROM xxx.file_info WHERE xxx.file_info.file_id = _id ) AS ffile_id,
@s := @s + 1 AS sort
FROM
( SELECT @r := 8, @s := 0 ) temp,
xxx.file_info
WHERE
@r > 0
) t1
JOIN xxx.file_info t2 ON t1._id = t2.file_id ;
注: xxx.file_info.ffile_id 是父级id,xxx.file_info是表名,xxx.file_info.file_id 当前id
8 是当前id,更替变量即可
边栏推荐
猜你喜欢

全国职业院校技能大赛网络安全B模块 Windows操作系统渗透测试

C language to achieve three chess? Gobang? No, it's n-chess

【时序逻辑电路】——寄存器

Traditional e-commerce dividends disappear, how to enter the new social e-commerce?

2D目标检测综述之学习策略篇(终章)

Pytorch deep learning practice lesson 10 / assignment (basic CNN)

File upload and download demo

【行测】图形找规律类题目
![[leetcode] 11. Container with the most water - go language solution](/img/42/3a1839dd768a5f02dc2acb5bd66438.png)
[leetcode] 11. Container with the most water - go language solution

第二部分—C语言提高篇_2. 内存分区
随机推荐
Prompt for garbled code when CHM file is opened
Unity中使用深度和法线纹理
Job search memo
In the era of e-commerce, what should enterprises do in the transformation of social e-commerce?
单点登录的三种实现方式
Empty cup mentality, start again
django.db.utils.OperationalError: (2002, “Can‘t connect to local MySQL server through socket ‘/var/r
AMD64(x86_64)架构abi文档:上
[sequential logic circuit] - register
周杰伦直播超654万人观看,总互动量破4.5亿,助力快手再破纪录
项目上线就炸,这谁受得了
Development system selection route
[steering wheel] the super favorite idea efficiency artifact save actions is uninstalled
Basic syntax of MySQL DDL and DML and DQL
GIMP自定义截图
被马斯克热炒的人形机器人Optimus“擎天柱“,中国厂商或后来居上
Part I - Fundamentals of C language_ 11. Comprehensive project - greedy snake
Traditional e-commerce dividends disappear, how to enter the new social e-commerce?
全国职业院校技能大赛网络安全B模块 缓冲区溢出漏洞
Bookkeeping app: xiaoha bookkeeping 1 - production of welcome page