Re: [SQL] conditional aggregates

2010-12-08 Thread Marcin Krawczyk
Thanks, it working. pozdrowienia mk 2010/12/8 Marc Mamin > something like ? > > > > Select min (case when X > 0 then X end) > > > > > > HTH, > > > > Marc Mamin > > > > *From:* pgsql-sql-ow...@postgresql.org [mailto: > pgsql-sql-ow...@postgresql.org] *On Behalf Of *Marcin Krawczyk > *Sent:* M

Re: [SQL] concatenate question

2010-12-08 Thread Tony Capobianco
Thanks so much to everyone for your responses. You've been very helpful. I'm running PostGres 8.4 and we're migrating our datawarehouse from Oracle 10.2. I guess datatype is implicitly cast in oracle under these circumstances: SQL> create table tony_test as select memberid||addeddate "data" fro

Re: [SQL] conditional aggregates

2010-12-08 Thread Marc Mamin
something like ? Select min (case when X > 0 then X end) HTH, Marc Mamin From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Marcin Krawczyk Sent: Mittwoch, 8. Dezember 2010 14:20 To: Pavel Stehule Cc: pgsql-sql@postgresql.org Subject: Re: [

[SQL] Regular Expression Match Operator escape character

2010-12-08 Thread Gnanakumar
Hi, We're running PostgreSQL v8.2.3 on RHEL5. In some places in our application, we use Regular Expression Match Operator (~* => Matches regular expression, case insensitive) inside WHERE criteria. Example: SELECT ... FROM ... WHERE (SKILLS ~* '(^|\\^|\\||[^0-9|^a-z|^A-Z]|$)C#(^|\\^|\\||[^0-9|^

Re: [SQL] conditional aggregates

2010-12-08 Thread Marcin Krawczyk
Yeah I know but I'm having problems creating sfunc fuction for the aggregate. regards mk 2010/12/8 Pavel Stehule > Hello > > use a CASE statement > > http://www.postgresql.org/docs/7.4/static/functions-conditional.html > > Regards > > Pavel Stehule > > 2010/12/8 Marcin Krawczyk : > > Hi list,

Re: [SQL] conditional aggregates

2010-12-08 Thread Pavel Stehule
Hello use a CASE statement http://www.postgresql.org/docs/7.4/static/functions-conditional.html Regards Pavel Stehule 2010/12/8 Marcin Krawczyk : > Hi list, > Can anyone advise me on creating an aggregate that would take additional > parameter as a condition ? For example, say I have a table l

[SQL] conditional aggregates

2010-12-08 Thread Marcin Krawczyk
Hi list, Can anyone advise me on creating an aggregate that would take additional parameter as a condition ? For example, say I have a table like this id;value 1;45 2;13 3;0 4;90 I'd like to do something like this SELECT min_some_cond_aggregate(value,0) FROM table to get the minimal value from