Re: [SQL] Comparing two tables of different database

2009-05-01 Thread John Zhang
Hi Nicholas, The query is across database query. dblink is needed for that task. Hope it helps, John On Thu, Apr 30, 2009 at 3:07 PM, Edward W. Rouse wrote: > Can’t you use this? > > > > select name from database2.sr_1 where name not in (select name from > database2.pr_1); > > > > My test da

[SQL] Add column by using SELECT statement

2009-02-24 Thread John Zhang
Hi all, I was wondering how I can add a column and populate it by some query. For example: TblA (Id, fld1) TblB(Id, fld1, fld2) I have a query: SELECT b.fld2 FROM tblB b WHERE condition1 what I want to do is add a column in tblA: fld2 and polpulate the newly added field with the query on tblA.I

[SQL] How to excute dynamically a generated SQL command?

2009-01-03 Thread John Zhang
Hi the list, Referring to the PostgreSQL 8.3 documentation " 38.5.4. Executing Dynamic Commands ", the command for executing a dynamic command is: EXECUTE command-string [ INTO [STRICT] target ]; I am to execute an sql statement created dynamically, which is represented in a variable sSql. Here

[SQL] Question on Escape-string

2008-12-31 Thread John Zhang
Dear all, I am using pl/pgsql to develop a function to implement some logic to load BLOB data, like .tif file, to postgres DB. The issue I am facing is the file name MUST be with double back-slash \\ in order for pgsql to process the string properly. However, when the string is Escaped in my funct