4
select 1 as a,4 as b, 5 as c; select 1 as a,3 as b; 

Result display only of `select 1 as a,3 as b;

How display result of multi select in PgAdmin III?`

1
  • 1
    pgAdmin can display only last result - btw PostgreSQL doesn't support multi record sets - It support multi selects, but result is only last result Commented Jul 24, 2013 at 4:22

1 Answer 1

3

One way around this limitation would be UNION ALL.

However, the row type of all SELECTs has has to match. So I added NULL for the missing column c in the second query. Could be any value that fits the data type:

SELECT 1 AS a, 4 AS b, 5 AS c FROM tbl_a UNION ALL SELECT 1 , 3 , NULL FROM tbl_b; -- aliases only needed in 1st SELECT 

Returns a single result set.

To indicate the source of each row you could add a column or slide in a row between individual SELECTs. Demonstrating both at once with VALUES expressions:

SELECT * FROM ( VALUES (1, 1, 14, 15) ,(1, 2, 17, 11) ) AS t(query, a, b, c) UNION ALL VALUES (NULL::int, NULL::int, NULL::int, NULL::int) -- delimiter UNION ALL ( VALUES (2, 3, 24, NULL::int) ,(2, 4, 27, NULL::int) ); 

Explicit type casts may be necessary. I only added what's absolutely necessary here. ->SQLfiddle demo.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.