Oliver Jowett wrote:
> yoursoft wrote:
>> Ok, the planner uses different way. I think the planner use the UNION
>> in PreparedStatement and not the UNION ALL?
>> How to rewrite the SQL to use the UNION ALL in preparedstatement?
> You need an ORDER BY or the order is undefined and unpredictable. See
> There's no simple way to say "give me rows from this table first"
> other than running a query on each table separately.
Actually the simple way is
select c1,c2,c3,...,cn from (select 1, table1.* from table1 union all
select 2, table2.* from table2 union all ...) a(ordercolumn, c1, c2, c3,
.., cn) order by 1
In response to
pgsql-jdbc by date
|Next:||From: Christian Rengstl||Date: 2007-11-30 10:52:39|
|Subject: Serial data type|
|Previous:||From: Donald Fraser||Date: 2007-11-29 10:00:11|
|Subject: Re: ssl connection and webstart|