by naasking · 3y ago · 0 comments
declare @x = (select * from Person)
select Name from @x where Birthdate < '2000-01-01' with persons as (select * from Person)
select Name from persons
where Birthdate < '2000-01-01 create table x as (select * from person);
select name from x where ...;
there you go, just configure your editor to display "create table x" as "declare x = " ;)or even a version with lazy evaluation:
create view x as (select * from person);
select name from x where ...;SQL just does not have this, it instead has 15 different second class ways to handle tables and queries that try to make up for the fact that they are not first-class values. These include CTEs, table valued functions, views, etc.