user12727390
user12727390

Reputation: 11

Alternative to SQL temp tables

I am using table A and B to create table C after some data manipulation. Table C is my temp table (only have read access to database). In a separate select statement, I am doing my final data prep and table C is being referenced multiple times in my final query.

My problem is the temp tables do not work with create view. And I need to create a view with my final query where I am using temp table C.

Can anyone suggest what can be the alternative to temp tables in this scenario?

Upvotes: 0

Views: 1796

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271141

You can use CTEs. In most databases, this would look like:

create view D as
    with C as (
          . . .
         )
    select . . .
    from C . . .;

Upvotes: 1

Related Questions