Re: [SQL] Extract interdependent info from one table

2008-01-25 Thread Andrej Ricnik-Bay
On 25/01/2008, Phillip Smith <[EMAIL PROTECTED]> wrote: > Absolutely clear as mud :P sorry ... I'm not too good with expressing my SQL needs, I'm afraid, Thanks for trying :} In the end I got it sorted with the following select dm.docnum, dm.alias1, dm.docname, dm.alias2 as "Status",

Re: [SQL] age() function usage

2008-01-25 Thread Marcin Krawczyk
Heh, that was easy, I must have been working for too long... :) Thanks 2008/1/25, Scott Marlowe <[EMAIL PROTECTED]>: > > On Jan 25, 2008 1:06 PM, Marcin Krawczyk <[EMAIL PROTECTED]> wrote: > > Hi all. I am trying to determine the way to pass a variable/field value > to > > an age() function, que

Re: [SQL] age() function usage

2008-01-25 Thread Scott Marlowe
On Jan 25, 2008 1:06 PM, Marcin Krawczyk <[EMAIL PROTECTED]> wrote: > Hi all. I am trying to determine the way to pass a variable/field value to > an age() function, query looks something like: > > SELECT age(timestamp data_zakonczenia_fakt) FROM kip_pracownicy_umowy WHERE > id_pracownika = 8 > > d

[SQL] age() function usage

2008-01-25 Thread Marcin Krawczyk
Hi all. I am trying to determine the way to pass a variable/field value to an age() function, query looks something like: SELECT age(timestamp data_zakonczenia_fakt) FROM kip_pracownicy_umowy WHERE id_pracownika = 8 data_zakonczenia_fakt being char column equal to say '1993-11-30'. Such approach

Re: [SQL] regex_replace problem

2008-01-25 Thread Frank Bax
Gary Stainburn wrote: Hi folks. I've got a problem with regex_replace. The function is regexp_replace - you misspelled it. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > On Jan 25, 2008 10:11 AM, acec acec <[EMAIL PROTECTED]> wrote: >> I have the following sql, which works fine under mysql >> database: >> SELECT sa.ID, suv.TOTAL as VOICE_TOTAL, sus.TOTAL as >> SMS_TOTAL FROM SUB_ACCOUNT sa INNER JOIN SUBSCRIBER s >> ON

Re: [SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread Oliveiros Cristina
Neither have I. The LEFT JOIN I know is something like SELECT ... FROM table1 LEFT OUTER JOIN table2 ON Try using this construct Best, Oliveiros - Original Message - From: "Scott Marlowe" <[EMAIL PROTECTED]> To: "acec acec" <[EMAIL PROTECTED]> Cc: Sent: Friday, January 25, 2008

Re: [SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread acec acec
Maybe it is not legal sql according to SQL standard, but it works under mysql, I try to port it into Postgresql. --- Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Jan 25, 2008 10:11 AM, acec acec > <[EMAIL PROTECTED]> wrote: > > I have the following sql, which works fine under > mysql > > databas

Re: [SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread Scott Marlowe
Please keep replies on list, others may have answers I do not. On Jan 25, 2008 10:29 AM, acec acec <[EMAIL PROTECTED]> wrote: > --- Scott Marlowe <[EMAIL PROTECTED]> wrote: > > On Jan 25, 2008 10:11 AM, acec acec > > <[EMAIL PROTECTED]> wrote: > > > I have the following sql, which works fine under

Re: [SQL] regex_replace problem -additional

2008-01-25 Thread Scott Marlowe
On Jan 25, 2008 10:19 AM, Gary Stainburn <[EMAIL PROTECTED]> wrote: > Sorry, > > should have added that I tried type-casting to see if that fixed it. It > didn't. > > Gary > > goole=# select distinct regex_replace(ud_rfl::text,' *= *'::text,'+'::text) \df regexp* List

Re: [SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread Scott Marlowe
On Jan 25, 2008 10:11 AM, acec acec <[EMAIL PROTECTED]> wrote: > I have the following sql, which works fine under mysql > database: > SELECT sa.ID, suv.TOTAL as VOICE_TOTAL, sus.TOTAL as > SMS_TOTAL FROM SUB_ACCOUNT sa INNER JOIN SUBSCRIBER s > ON (sa.ID = s.SUB_ACCOUNT_ID) LEFT JOIN (SERVICE suv,

Re: [SQL] regex_replace problem -additional

2008-01-25 Thread Gary Stainburn
Sorry, should have added that I tried type-casting to see if that fixed it. It didn't. Gary goole=# select distinct regex_replace(ud_rfl::text,' *= *'::text,'+'::text) from used_diary where ud_rfl ~ ' *= *'; ERROR: function regex_replace(text, text, text) does not exist HINT: No function ma

Re: [SQL] Unclosed connections

2008-01-25 Thread Scott Marlowe
On Jan 25, 2008 10:02 AM, PostgreSQL Admin <[EMAIL PROTECTED]> wrote: > We are using this bad piece of the software that does not close > connections to the postgres server. Is there some setting for closing > dead connections? And not TCP/IP keep alive does not work. If the TCP keepalive can't d

[SQL] regex_replace problem

2008-01-25 Thread Gary Stainburn
Hi folks. I've got a problem with regex_replace. As you can see below psql displays the error saying the function does not exist. Can anyone see why, and what I need todo to fix it. Cheers goole=# select distinct ud_rfl from used_diary where ud_rfl ~ ' *= *'; ud_rfl --- 12 = 1wk

[SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread acec acec
I have the following sql, which works fine under mysql database: SELECT sa.ID, suv.TOTAL as VOICE_TOTAL, sus.TOTAL as SMS_TOTAL FROM SUB_ACCOUNT sa INNER JOIN SUBSCRIBER s ON (sa.ID = s.SUB_ACCOUNT_ID) LEFT JOIN (SERVICE suv, SERVICE sus) ON (sa.ID = suv.SUB_ACC_ID AND suv.SERVICE_ID = 0 AND sa.ID

[SQL] Unclosed connections

2008-01-25 Thread PostgreSQL Admin
We are using this bad piece of the software that does not close connections to the postgres server. Is there some setting for closing dead connections? And not TCP/IP keep alive does not work. ---(end of broadcast)--- TIP 4: Have you searched our

Re: [SQL] date format

2008-01-25 Thread Frank Bax
iuri de araujo sampaio wrote: hi, how to change the default format for type date? I have created a field on a table: ## create table tbl_inventory ( item_id integer constraint c_pk primary key, I. purchase_date date, II. fabrication_date date, III. ex

Re: [SQL] improvements to query with hierarchical elements

2008-01-25 Thread Steve Midgley
At 07:24 PM 1/22/2008, you wrote: Hi all, I have created a little test database to help illustrate my situation. CREATE TABLE categories ( id integer NOT NULL, name character varying(255) NOT NULL, description character varying(255), vocabulary_id integer, derived boolean )