MySQL中有类似MSSQL中的with关键字么,该怎么解决

MySQL中有类似MSSQL中的with关键字么

MS-SQL 2005以后,声明临时表出现With的用法。比如:

with tb as(

select orderid,sum(Qty) as 数量 from orderdetails group by orderid 

)

select *

from tb tb1

join tb tb2 on tb1.orderid=tb2.orderid

……

……

像这种临时表tb我需要多次使用,用with声明比较方便。

在MySQL中有类似关键字么?或者MySQL的解决方案是什么?

初来乍到,请教大家。



没有。




没有。

你可以通过子查询,或者临时表来解决。




可以这样使用零时表。比如t就是一个零时表

mysql> select * from (select * from user) as t where t.userName=”zhanghong”;




暂时还没这个功能

MySQL中有类似MSSQL中的with关键字么,该怎么解决

相关文章:

你感兴趣的文章:

标签云: