MySQL结果表在while循环中加入多个SELECT结果

时间:2019-06-26 03:42:26

标签: mysql

有没有人想到在MySQL中将其转换为while循环的最有效方法?

select * from 1eg_usuarios where 
        user_id_1eg= (select @ult_anf:= id_anfitrion_1eg from 1eg_usuarios where user_id_1eg=121) #40
        or
        user_id_1eg= (select @ult_anf:= id_anfitrion_1eg from 1eg_usuarios where user_id_1eg=@ult_anf) #13
        or
        user_id_1eg= (select @ult_anf:= id_anfitrion_1eg from 1eg_usuarios where user_id_1eg=@ult_anf) #4
        or
        user_id_1eg= (select @ult_anf:= id_anfitrion_1eg from 1eg_usuarios where user_id_1eg=@ult_anf); #1

谢谢。

1 个答案:

答案 0 :(得分:1)

您是否要递归查询try: from googlesearch import search except ImportError: print("No module named 'google' found") query = "iphone 7 32gb" for j in search(query, tld="com", num=10, stop=10, pause=2): print(j)

MySQL 8.0引入了id_anfitron_1eg子句

with

How to create a MySQL hierarchical recursive query