M
M
Mimuss2017-07-22 04:06:53
PostgreSQL
Mimuss, 2017-07-22 04:06:53

How to make a temporary table with the same data?

Let's say there is this:
SELECT 'Economy';
produces:
?column?
----------
Economy
(1 row)
I would like to have not one row, but several, according to my desire. And yes, without creating an intermediate table.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2017-07-22
@Mimuss

small note #3: what the hell do you need a cross join for?
SELECT 'Economy' FROM generate_series(1,10);

A
Alexander Kuznetsov, 2017-07-22
@DarkRaven

A small side note to DevMan 's answer :

SELECT
  cols.*
FROM 
  (SELECT 'Economy'::character varying (25)  economy) AS cols
CROSS JOIN
  generate_series(1,10);

I changed SELECT 'Economy'::character varying (25) economyto not have ?column? , well, I set the explicit type.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question