Re: [SQL] INSERT only under certain conditions (SELECT)

2002-07-08 Thread Joachim Trinkwitz
Maybe I should explain my problem a little bit: simplified, I have two tables, L and T, (which values references to L): L: art|kvvnr|semester ---+-+ 7.0| 4151| 2002ws 7.0| 4326| 2002ws 6.1| 4200| 2002ws 7.0| 4151| 2001ws (combination of kvvnr and semester is unique) T: id

[SQL] INSERT only under certain conditions (SELECT)

2002-07-07 Thread Joachim Trinkwitz
Hi, I want to insert a row only under condition that there isn't already another row with similar values -- something like a INSERT INTO ... WHERE NOT EXISTS (SELECT ...)? Hoping for help, joachim ---(end of broadcast)--- TIP 3: if posting/readi

[SQL] Aggregates not allowed in WHERE clause?

2002-06-19 Thread Joachim Trinkwitz
Hi all, I have a table (lv) with a field "semester" and I'm trying to fish out all rows which have a value corresponding to a max() value of another table's (lf_sem) "semester" field. The intention is to keep a value with the current term in lf_sem so I can get all rows which concern this term.

Re: [SQL] Problems with pg_dump (on Debian i386)

2001-05-28 Thread Joachim Trinkwitz
Tom Lane <[EMAIL PROTECTED]> writes: > Could we see a specific example please --- preferably, enough of the > dump file to reproduce the problem? Also, exactly *what* version hop > are we talking about? Example file (extract of my dump file) is attached -- the misbehaviour occurs even when simp

[SQL] Problems with pg_dump (on Debian i386)

2001-05-25 Thread Joachim Trinkwitz
import fails. This used to work in earlier versions. Hoping for help, joachim -- Dr. Joachim Trinkwitz email: [EMAIL PROTECTED] Germanistisches Seminar phone: 0228-737565 Rheinische Friedrich-Wilhelms-Universitaet fax: 0228-737479 Am Ho

[SQL] copying/moving from one table to another

2000-09-27 Thread Joachim Trinkwitz
Hi all, is there a handy way to copy or (preferrably) move a whole record from one table to another, equally structured table in the same DB? Background: I have some tables which hold information concerning our staff, where people quite so often come and go, because their employment contract is

Re: [SQL] retrieving a serial number

2000-07-02 Thread Joachim Trinkwitz
"Robert B. Easter" <[EMAIL PROTECTED]> writes: > You can do something like this: > $var = SELECT nextval('seq_name'); > INSERT INTO master (id, ...) VALUES ($var, ...); > INSERT INTO slave1 (id, ...) VALUES ($var, ...); Great feaure. What to do when importing some previous data from ascii files