In case dblink was not installed, you could try the following:
1. dump only the data from the table from database 1
pg_dump -U username -a -d -t tablename dbname > tablename.sql
2. create a (temp) table in database 2
SELECT * INTO tablename_bak from tablename WHERE 1 = 2
3. restore the dumped d
Andreas,
Kretschmer was quite close, try following:
case
when trim(coalesce(s1,'')) = '' and trim(coalesce(s3,'')) = '' then ''
when trim(coalesce(s1,'')) != '' and trim(coalesce(s2,'')) != '' and
trim(coalesce(s3,'')) != '' then s1 || s2 || s3
else trim(coalesce(s1,'')) || trim(coalesce
Andreas you could either use the system columns oid or ctid.
The ctid will always be available, but the oid will only be available
if you created the table with "with oids" syntax( > version 8.0).
UPDATE status_table
SET status_id = -1
WHERE ctid = (SELECT MIN(RMV.ctid)
FROM status_
values in this column - ie, if a user cancels after you
seect nextval, but before you insert - the value of the sequence has
already increased, and will be increased again before returning a
value when you next select nextval
Cheers,
~p
On Wed, 2007-03-07 at 12:57 +0100, M.P.Dankoor wrote:
H
Hello,
Is it possible to redesign your table as follows:
create table Mod48_00_2007 (
IDtext,
N_GEN serial not null,
FORMSTORE text,
COD_NOTATIO text,
PA_COGNOMEtext,
constraint pk_Mod48_00_2007 primary key (N_GEN)
);
Your insert simply becomes:
INSERT INTO MOD
Louis-David Mitterrand wrote:
Hello,
I've got a table of shows with different types (movie, theater,
ballet,etc.) and I am looking for a select that can return the 10 last
entered shows AND at most 2 of each type. Is that possible in one query?
The table looks basically like:
created_on
Louis-David Mitterrand wrote:
Hello,
I've got a table of shows with different types (movie, theater,
ballet,etc.) and I am looking for a select that can return the 10 last
entered shows AND at most 2 of each type. Is that possible in one query?
The table looks basically like:
created_on
I think that the simplest solution is to use an union e.g:
select PRD.product_code
,PRD.product_name
,NULL::intAS production_no
,PTT.stock_code_to_make_product
,PTT.amount
from product PRD
,product_tree_template PTT
where 1 = 1
AND PRD.product_code = PTT.