与自己连接表是没问题的。但我需要加入一个创建的选择。第一个想法:使用临时表,但我只能打开一次。这是真的吗?
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
通常如何解决?
答案 0 :(得分:2)
您可以多次加入临时表
select * into #temp from asdf where term
...
join #temp as one
join #temp as two
...
join #temp as ten