对表中的每一行运行查询

时间:2018-12-22 16:31:32

标签: mysql database recursive-query mysql-8.0

choose_vars_soln: [1.0, 0.0, 0.0, 0.0]
choosen_value: 1.1

我试图使以上内容针对with recursive cte (id, name, boss_id, salary) as ( select id, name, boss_id, salary from employees where id = 30 union all select p.id, p.name, p.boss_id, p.salary from employees p inner join cte on cte.boss_id = p.id ) SELECT t1.id, cte.id as 'boss_id' FROM cte, (SELECT id, salary FROM cte ORDER BY salary ASC LIMIT 1) as t1 WHERE cte.salary >= 2 * t1.salary ORDER By cte.salary ASC LIMIT 1 表中的每个id运行,而不仅仅是employees条款中指定的运行。我该如何适应这种行为?

0 个答案:

没有答案