Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作为下面的示例代码....
WITH sampleA as (SELECT * FROM emp) SELECT * FROM sampleA SELECT * FROM sampleA
此别名“sampleA”仅适用于第一个查询,不适用于第二个或以后的查询。
但我只想用这个别名查询更多信息。
你能帮我吗,我该怎么做?
公用表表达式范围仅限于第一个 SELECT 语句。对于多次使用,请改用临时表或表变量。