Re: [SQL] Last record

2002-07-25 Thread omid omoomi
select * from foo_table order by oid desc limit 1; >From: Chris Ruprecht <[EMAIL PROTECTED]> >To: "Leao Torre do Vale" ><[EMAIL PROTECTED]>,<[EMAIL PROTECTED]> >CC: Jan Wieck <[EMAIL PROTECTED]> >Subject: Re: [SQL] Last record >Date: Wed, 24 Jul 2002 13:56:50 -0400 > >Select * from where <..

Re: [SQL] getting the oid for a new tuple in a BEFORE trigger

2001-08-29 Thread omid omoomi
hi, Idon't know the best way but how about a quick insert in a temp table and adding 1 to the inserted oid column each time the trigger will run.! regards Omid >From: Markus Wagner <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED], [EMAIL PROTECTED], >[EMAIL PROTECTED] >Subject: [SQL] getting the oid

Re: [SQL]

2001-08-29 Thread omid omoomi
hi, Grant all on sequence_name to theuser ; regards omid >From: "Vladimir Terziev" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: [SQL] >Date: Wed, 29 Aug 2001 10:40:00 +0300 > >Hi, > >I'm writing a script, which has to retrieve a next value from a sequnce. I >use >mod_perl, DBI and DBD::

Re: [SQL] Getting 'n-1'th record.

2001-08-21 Thread omid omoomi
Hi, It is a not a clean job but how about having a view like this : create view foo_view as select * from yourtable order by oid desc limit 2 ; and then making your select like this: select * from foo_view order by oid limit 1; hope that helps Omid >From: Bhuvan A <[EMAIL PROTECTED]> >To: [EMA

Re: [SQL] is it possible to use arrays in plpgsql function??

2001-08-21 Thread omid omoomi
hi, I had the same question a couple of days ago and I received some good helps. look at the archives... regards Omid >From: Bhuvan A <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: [SQL] is it possible to use arrays in plpgsql function?? >Date: Tue, 21 Aug 2001 11:24:08 +0530 (IST) > > >hi

[SQL] split/explode functions

2001-08-20 Thread omid omoomi
hi , Is there any split or explode function which split a whole string to seperate parts using any special delimiter ? TIA Omid _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -

[SQL] Array in plpgsql

2001-08-19 Thread omid omoomi
hi all, Can some body show me how to declare a variable of type "array" in a function using plpgsql ? TIA Omid Omoomi _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -

Re: [SQL] Function define question

2001-08-18 Thread omid omoomi
hi, It depends on the variable type: foo=> create function f1( int4) returns int4 as' foo'> select $1 ;' foo-> language 'sql'; CREATE foo=> select f1(4); f1 -- 4 (1 row) regards Omid >From: "Bill" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: [SQL] Function define question >Date: Sat, 18

Re: [SQL] How to get the server version??

2001-07-24 Thread omid omoomi
select version(); >From: Roberto João Lopes Garcia <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: [SQL] How to get the server version?? >Date: Tue, 24 Jul 2001 10:50:50 -0300 > >Hi > >Is there any way, possible an SQL or pgsql command, to get the server >version? > >Thank you > >Roberto >

Re: [SQL] position(text,text) function

2001-07-23 Thread omid omoomi
position ( 'el' in 'hello') ; >From: [EMAIL PROTECTED] (Karl Orbell) >To: [EMAIL PROTECTED] >Subject: [SQL] position(text,text) function >Date: Mon, 23 Jul 2001 14:27:15 + (UTC) > >I'm having trouble using the position function, it's a simple built-in >function. > >It returns the index of a

[GENERAL] Re: Aggregates and joined tables...

2001-02-08 Thread omid omoomi
sum - --- ali 100 omid 200 shaya 50 then I get this: fa1 sum - --- ali 350 omid 350 shaya 350 Any more idea ? Omid Omoomi >>The platform is PostgreSQL 6.5.2 on i386-unknown-freebsd3.2, compiled b

[GENERAL] Aggregates and joined tables...

2001-02-04 Thread omid omoomi
can I have my result with only one SQL statement ? Thanks in advance Omid Omoomi _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Re: [SQL] Table Attribute Help

2000-10-09 Thread omid omoomi
but as a select command. Is this possible? > > yes. try to run psql with -E and look at the related system tables when running \d command like (pg_class, pg_user, ...) regards Omid Omoomi _ Get Your Private, Free E-mail f

Re: [SQL] primary key question

2000-07-20 Thread omid omoomi
>From: Carolyn Lu Wong <[EMAIL PROTECTED]> >To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >Subject: [SQL] primary key question >Date: Thu, 20 Jul 2000 17:26:30 +1000 > >create table aaa( > field1 not null, > field2 , > , > primary key (field1, field2) >); >

Re: [SQL] Select by priority

2000-07-16 Thread omid omoomi
Hi, How about ordering by Address_type ? only needs to have 1, 2, 3 as different address types in your desired order. like : select person_id , address where address in not null order by address_type limit 1 ; sure you can change the limit if you wish more addresses. hope that helps Omid

Re: [SQL] Median

2000-07-05 Thread omid omoomi
Hi, I'll be glad if you describe more details about the problem. Is it a kind of statistical analysis or what? Omid Omoomi >From: "Kermani, Bahram" <[EMAIL PROTECTED]> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> >Subject: [SQL] Median

Re: [SQL] Fetch an element in an array

2000-06-08 Thread omid omoomi
$row = pg_fetch_array($exec, 1); echo $row['col2']; Regards Omid Omoomi >From: Bernie Huang <[EMAIL PROTECTED]> >To: PGSQL-SQL <[EMAIL PROTECTED]> >Subject: [SQL] Fetch an element in an array >Date: Wed, 07 Jun 2000 17:21:52 -0700 > >Hi, > >This i

RE: [SQL] 7.0 weirdness

2000-05-30 Thread omid omoomi
If so then why do you need to use "select distinct " ?! BTW, I just tested on my 6.5.2, This query : "Select distinct f1 from table1 order by f2 " works the same as this one: "select distinct f1,f2 from table1" >From: Jeff MacDonald <[EMAIL PROTECTED]> >Reply-To: Jeff MacDonald <[EMAIL PROTECTED

Re: [SQL] 7.0 weirdness

2000-05-30 Thread omid omoomi
would need to change the table structure to a better normal form. Regards , Omid Omoomi >From: Jeff MacDonald <[EMAIL PROTECTED]> >Reply-To: Jeff MacDonald <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED], [EMAIL PROTECTED] >Subject: [SQL] 7.0 weirdness >Date: Tue, 30 May 2000 0