把一个表和它本身连接起来是没有问题的。但我需要自己加入一个创建的select。第一个想法:使用临时表,但我只能打开一次。这是真的吗?
MySQL是否足够聪明,可以计算一个只有一次相同项的子选择?
如:

join (select * from asdf where term) as one
join (select * from asdf where term) as two
...
join (select * from asdf where term) as ten

通常是怎么解决的?

最佳答案

您可以多次连接临时表

    select * into #temp from asdf where term
    ...
    join #temp as one
    join #temp as two
    ...
    join #temp as ten

关于mysql - 如何与自己加入选择?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14831207/

10-14 14:18
查看更多