Re: [SQL] count question

2008-04-08 Thread ashish
Volkan YAZICI wrote: > On Wed, 9 Apr 2008, novice <[EMAIL PROTECTED]> writes: > >> Is it possible to write a query to produce: >> >> meter_id | no_of_bays | bay_id >> --++--- >> 5397 | 2 | 5397-01 >> 5397 | 2 | 5397-02 >> 5409 |

Re: [SQL] count question

2008-04-08 Thread Volkan YAZICI
On Wed, 9 Apr 2008, novice <[EMAIL PROTECTED]> writes: > Is it possible to write a query to produce: > > meter_id | no_of_bays | bay_id > --++--- > 5397 | 2 | 5397-01 > 5397 | 2 | 5397-02 > 5409 | 3 | 5409-01 > 5409

Re: [SQL] count question

2008-04-08 Thread rdeleonp
On 4/8/08, Craig Ringer <[EMAIL PROTECTED]> wrote: > novice wrote: > > > Is it possible to write a query to produce: > > > > meter_id | no_of_bays | bay_id > > --++--- > > 5397 | 2 | 5397-01 > > 5397 | 2 | 5397-02 > > 5409 |

Re: [SQL] count question

2008-04-08 Thread Craig Ringer
novice wrote: > Is it possible to write a query to produce: > > meter_id | no_of_bays | bay_id > --++--- > 5397 | 2 | 5397-01 > 5397 | 2 | 5397-02 > 5409 | 3 | 5409-01 > 5409 | 3 | 5409-02 > 5409 |

[SQL] count question

2008-04-08 Thread novice
i have a table CREATE TABLE meter ( meter_id integer NOT NULL, no_of_bays integer, CONSTRAINT meter_pkey PRIMARY KEY (meter_id) ) INSERT INTO meter( meter_id, no_of_bays) VALUES (5397, 2); INSERT INTO meter( meter_id, no_of_bays) VALUES (5409, 3); select

Re: [SQL] Pattern Matchig

2008-04-08 Thread Tk421
Alvaro Herrera escribió: Tk421 escribió: The result is only record number 3. How can i search the entire FOOBAR word? The result wanted must be all, excepting 5. Something like this: select code from table where text ~ '[[:<:]]foobar[[:>:]]' Thank you very mu

Re: [SQL] Pattern Matchig

2008-04-08 Thread Alvaro Herrera
Tk421 escribió: >The result is only record number 3. How can i search the entire > FOOBAR word? The result wanted must be all, excepting 5. Something like this: select code from table where text ~ '[[:<:]]foobar[[:>:]]' -- Alvaro Herrerahttp://www.CommandP

[SQL] Pattern Matchig

2008-04-08 Thread Tk421
Hello everybody I'm trying to make a query in a table to find the records who contains a full word 'im looking for. Here is an example about i'm trying code text 1foobar 2 foobar 3 foobar y 4foobar

Re: [SQL] pl/PgSQL, variable names in NEW

2008-04-08 Thread Alvaro Herrera
Martin Edlman wrote: > I don't want to rewrite whole trigger to plPerl as I would have to use > DBD-PgSPI. Huh? Certainly not -- there are functions in PL/Perl for this. See spi_exec_query in http://www.postgresql.org/docs/8.3/static/plperl-database.html -- Alvaro Herrera

Re: [SQL] pl/PgSQL, variable names in NEW

2008-04-08 Thread Martin Edlman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, | no, it's not possible in plpgsql. Please, use plperl or plpython. thanks for the response. It's as I expected and was afraid of :-( I select data from DB using pl/PgSQL in the replace_values trigger and then call plPerl function which retu