Re: [SQL] select distinct and order by

2004-04-28 Thread Viorel Dragomir
I don't know if this will work, but why not try it ? :)   select distinct fullname, distinct staff_id, loginname from staffwhere staff_id in   (select staff_id from staffmembership where staffgroup_id=#SomeIdValue#)order by fullname, staff_id     Next one is more complicate but with more chan

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Viorel Dragomir
So use Grant more wisely. - Original Message - From: "Rodrigo Sakai" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 2:44 PM Subject: [SQL] Compiling pl/pgsql functions >Hi, I'm responsable for the database here in the company, and I like to know if is

Re: [SQL]

2004-01-29 Thread Viorel Dragomir
So, you are an artist. Isn't it? :) Your query is actually a string. This is your string: INSERT into table values(a,b,c,d)   You must change your string to actually use values of tha a, b... You can make this string with sprintf sprintf(string, "INSERT into table values(%d,%d,%d,%d)", a, b, c

Re: [SQL] auto_insert

2004-01-29 Thread Viorel Dragomir
serial   ex:   create table a( i serial, b int);   bye   - Original Message - From: jodi To: [EMAIL PROTECTED] Sent: Thursday, January 29, 2004 10:27 Subject: [SQL] auto_insert I'm looking function at postrgeSQL the same like "auto_insert " function at mySQL

Re: [SQL] Copying rows between tables?

2004-01-13 Thread Viorel Dragomir
- Original Message - From: "Steve Wampler" <[EMAIL PROTECTED]> To: "Postgres-SQL" <[EMAIL PROTECTED]> Sent: Tuesday, January 13, 2004 18:23 Subject: [SQL] Copying rows between tables? > > I know I can select from one table into a new table, but is > there a way to select from one table

Re: [SQL] Conversion from Sybase ASA

2003-09-09 Thread Viorel Dragomir
select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' then 'U' else 'P' endif) as pres from ftrans   select 'T' as src,(CASE WHEN tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' THEN  'U' ELSE  'P' END) as pres from ftrans   I think it works in Oracle too

Re: [SQL] looking for empty fields

2003-08-10 Thread Viorel Dragomir
Title:   - Original Message - From: Jodi Kanter To: Postgres SQL List Sent: Wednesday, August 06, 2003 5:07 PM Subject: [SQL] looking for empty fields We recently upgraded from version 7.2.3 to 7.3.3 and seem to have some

[SQL] transactions

2003-07-29 Thread Viorel Dragomir
Is there any known issues regarding transactions. I got something like:   begin transaction select function1() select into v1 function2() if v1='ok' then commit else rollback end if   To notice that both functions have about 100 lines of code. And both functions uses the same tables but in d

Re: [SQL] summing tables

2003-07-19 Thread Viorel Dragomir
d the option ORDER for the update command. - Original Message - From: "Greg Stark" <[EMAIL PROTECTED]> To: "Viorel Dragomir" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 15, 2003 5:55 PM Subject: Re: [SQL] summing tables > &g

Re: [SQL] NOT and AND problem

2003-07-17 Thread Viorel Dragomir
- Original Message - From: "Richard Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 17, 2003 5:29 PM Subject: [SQL] NOT and AND problem > Dear All, > > I am having some confusion over a query which is supposed to achieve the > following: To remove a record from a

Re: [SQL] Is it possible to connect to another database

2003-07-17 Thread Viorel Dragomir
$db_conn1 = pg_connect("dbname=db1"); $db_conn2 = pg_connect("dbname=db2"); . You can't join two tables from different databases(, as far as i know :). - Original Message - From: "BenLaKnet" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 17, 2003 5:03 PM Subject: [SQ

Re: [SQL] pg_dump "feature"

2003-07-16 Thread Viorel Dragomir
fopen($tmp_fname, "w"); fwrite($f, "$username\n".USER_DB_PASSWORD."\n"); fclose($f); $cmd = "pg_dump $add_cmd $export $add_table < $tmp_fname"; $result = system($cmd); unlink($tmp_fname); - Original Message - Fro

[SQL] pg_dump "feature"

2003-07-16 Thread Viorel Dragomir
In 7.1.2 you can launch this command without any problems: pg_dump -u -s database < file.txt   where file.txt contains 2 lines: username password ~ ~ ~   And you'll get the dump of the .   In 7.1.3 this command work, the only incovenience is that pg_dump shows "User name: Password:" but get

Re: [SQL] summing tables

2003-07-15 Thread Viorel Dragomir
- Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Viorel Dragomir" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 15, 2003 6:42 PM Subject: Re: [SQL] summing tables > "Viorel Dragomir" <[EMAIL PROTECTE

Re: [SQL] summing tables

2003-07-15 Thread Viorel Dragomir
Thiele" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 15, 2003 6:14 PM Subject: Re: [SQL] summing tables > Erik Thiele <[EMAIL PROTECTED]> writes: > > "Viorel Dragomir" <[EMAIL PROTECTED]> wrote: > >> update table_name >

Re: [SQL] summing tables

2003-07-15 Thread Viorel Dragomir
end loop; return var2; end; ' language 'plpgsql'; - Original Message - From: "Erik Thiele" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 15, 2003 3:39 PM Subject: Re: [SQL] summing tables > On Tue, 15 Jul 2003 15:16:2

Re: [SQL] summing tables

2003-07-15 Thread Viorel Dragomir
update table_name set c = a + b + (select c from table_name as x where x.seq = seq-1) where c is null; additional checks are required if you want to update c when c is not null if all the c are null then this query will do nothing god help u :) - Original Message - From: "Erik Thiele" <