Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread Michael Glaesemann
On Aug 20, 2007, at 20:33 , novice wrote: Many many thanks for all the advice =) Glad to help. Good luck! Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread Michael Glaesemann
On Aug 20, 2007, at 20:27 , Michael Glaesemann wrote: Note: record_id is in integer, yet you're quoting the value ('1'). This causes the server to cast the text value to an integer. Here it's not going to cause much of a problem, just a couple CPU cycles. In table definitions (and possibly

Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread novice
Many many thanks for all the advice =) On 21/08/07, Michael Glaesemann <[EMAIL PROTECTED]> wrote: > > On Aug 20, 2007, at 19:52 , novice wrote: > > > Try 2: Here are my DDLs & DMLs > > Thanks for the data. It looks like the data you provided in the first > set was a little different, and the quer

Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread Michael Glaesemann
On Aug 20, 2007, at 19:52 , novice wrote: Try 2: Here are my DDLs & DMLs Thanks for the data. It looks like the data you provided in the first set was a little different, and the queries I supplied in my previous message give you the results you want. CREATE TABLE record ( record_id

Re: [SQL] Join query help

2007-08-20 Thread novice
On 21/08/07, Michael Glaesemann <[EMAIL PROTECTED]> wrote: > Now here's where I started having trouble. I can't figure out how to > get 2 observations for week 29 (record_id 1 & 3) and 8 for week 30 > (record_id 2). Assuming the data is wrong (which is admittedly a poor > assumption), I moved ahea

Re: [SQL] Join query help

2007-08-20 Thread Michael Glaesemann
On Aug 18, 2007, at 0:35 , novice wrote: What query do I write to generate the following? week_no | count(record_id | count(observation_id) | sum(score_id) where = '1' 2007, 30 | 2 | 8 | 6 2007, 29 | 1 | 2 | 1 Okay: let's take a look at what you're trying to get: fi

Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread novice
Try 2: Here are my DDLs & DMLs -- Start CREATE TABLE record ( record_id integer PRIMARY KEY, record_date timestamp with time zone NOT NULL ); INSERT INTO record(record_id, record_date) VALUES ('1', '2007-07-23 11:30:37'); INSERT INTO record(record_id, record_date) VALUES ('2', '2007-07-27 1

Re: [SQL] When is a shared library unloaded?

2007-08-20 Thread Jon Horsman
Here is a little more information about my problem. There is a library( that has stored procedures) for processing trigger events. The library is loaded on first access( i.e when there is a trigger event to be sent). Normally, it gets unloaded during a postgres server shutdown but the library se

Re: [SQL] TRIGGERS and FUNCTIONS

2007-08-20 Thread Richard Broersma Jr
--- ashok raj <[EMAIL PROTECTED]> wrote: > Hello All , > >I am having a table named "test" with a trigger " tri_test > " which triggers the function " replicate() " on insert, update and > delete . >Can I able to get the SQL STATEMENT which triggers the