[SQL] tricky GROUP BY / JOIN question

2004-11-07 Thread T E Schmitz
Hello, I'm sorry I couldn't think up a more precise subject line. I would like to know whether the following can be implemented in SQL: The example below joins 4 tables ITEM, BRAND, MODEL and CONDITION. In human understandable terms: a [secondhand] Item is of a particular Model and Brand. The Ite

Re: [SQL] tricky GROUP BY / JOIN question

2004-11-07 Thread Tom Lane
T E Schmitz <[EMAIL PROTECTED]> writes: > This is *almost* what I need: > SELECT > BRAND.BRAND_NAME, > MODEL.MODEL_NAME, > min (ITEM.PRICE),max (ITEM.PRICE) > *min (CONDITION.POSITION),max (CONDITION.POSITION)* > FROM ITEM > left outer join MODEL on MODEL_PK =ITEM.MODEL_FK > left outer join BRAND

Re: [SQL] Join Table

2004-11-07 Thread Mischa Sandberg
T E Schmitz wrote: On Mon, Nov 01, 2004 at 04:34:32PM +, T E Schmitz wrote: Question: is it necessary/advisable to create an index for the ITEM_FK column? Or is this redundantbecause this column is already one of the PK columns? However, read the "Multicolumn Indexes" section in the "Indexes"

[SQL] query using a date field that isn't set

2004-11-07 Thread John B. Scalia
Hi all,   I’ve got a SQL problem that’s stumping me. I have an employee table with a field labeled:   Emp_terminated    DATE   Obviously, some employees in this table won’t have this field set. I want a query to select only employees without this field being set, ie., only cur

[SQL] third edition of SQL FOR SMARTIES

2004-11-07 Thread --CELKO--
I am getting ready to do the third edition of SQL FOR SMARTIES this month. If anyone has an SQL programming technique, trick or tip that they would like to see in the book, drop me an email. You get a virtual beer and your name in the book. Even better, if you have an improvement on something in

[SQL] oracle v$session equivalent in postgresql

2004-11-07 Thread stuff
I’m looking for the equivalent in postgresql to the v$session variables in Oracle. In particular, I need to convert the following statement:   select s.program, s.machine into :New.app_name,:New.comp_name from v$session s where s.audsid=userenv('SESSIONID');

Re: [SQL] query using a date field that isn't set

2004-11-07 Thread D'Arcy J.M. Cain
On Tue, 02 Nov 2004 10:44:41 -0500 "John B. Scalia" <[EMAIL PROTECTED]> wrote: > I've got a SQL problem that's stumping me. I have an employee table > with a field labeled: > > Emp_terminatedDATE > > Obviously, some employees in this table won't have this field set. I > want a query t

Re: [SQL] third edition of SQL FOR SMARTIES

2004-11-07 Thread D'Arcy J.M. Cain
On 2 Nov 2004 11:36:09 -0800 [EMAIL PROTECTED] (--CELKO--) wrote: > I am getting ready to do the third edition of SQL FOR SMARTIES this > month. If anyone has an SQL programming technique, trick or tip that > they would like to see in the book, drop me an email. Can we see the book online? I hav

Re: [SQL] CREATE TRIGGER ... FOR EACH STATEMENT

2004-11-07 Thread Mischa Sandberg
Please ignore this, I just caught up with news in c.d.p.hackers Mischa Sandberg wrote: I notice a dearth of description of the FOR EACH STATEMENT flavour of triggers, even though OLD_TABLE and NEW_TABLE are mentioned. After years of Sybase & MSSQL, being able to deal with the entire INSERTED/DELE

Re: [SQL] Group by and aggregates

2004-11-07 Thread Sam Mason
Michael L. Hostbaek wrote: >Now, I need the first line to say "15.00" in the cmup field. That is, >stock and incoming are obviously not being grouped, but since it's the >same partno I'd like somehow to show the highest cmup. Is there some >black SQL voodoo that'll achieve this ? I think you need

[SQL] Scheduling Jobs In PostgreSQL

2004-11-07 Thread Chethana Kuloor
Is it possbile to schedule jobs in postgres? __ Post your free ad now! http://personals.yahoo.ca ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an

[SQL] Oracle to Postgres

2004-11-07 Thread Mickael Faivre-Macon
Hi, I have this Pro*C statement EXEC SQL AT db_name DESCRIBE BIND VARIABLES FOR S1 INTO bdp; that I must translate into PL/pgSQL (compiled into c with ecpg) I can not find a description of describe in the postgres 7.3 documentation. Could someone help me ? Postgres does not support SQLDA structu

Re: [SQL] Simple SQL Question

2004-11-07 Thread Bricklen
Andras Kutrovics wrote: Hi All! In one of my application, I would like to implement incremental fetching. The problem is that I would like to run it from a stateless application server, so I have to tell where to begin fetching data. It is simple for a table which has single column primary key, but

[SQL] CREATE TRIGGER ... FOR EACH STATEMENT

2004-11-07 Thread Mischa Sandberg
I notice a dearth of description of the FOR EACH STATEMENT flavour of triggers, even though OLD_TABLE and NEW_TABLE are mentioned. After years of Sybase & MSSQL, being able to deal with the entire INSERTED/DELETED rowsets in a trigger, rather than nibbling away row by row, has been a great effici

Re: [SQL] Scheduling Jobs In PostgreSQL

2004-11-07 Thread Michael Fuhr
On Fri, Nov 05, 2004 at 12:05:24PM -0500, Chethana Kuloor wrote: > Is it possbile to schedule jobs in postgres? Most operating systems come with some kind of scheduler (e.g., cron on Unix-like systems). Are you not able to use that? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ -

[SQL] Hi

2004-11-07 Thread vasundhar
Hi I am using REL on which only 7.3.2 PG only available and I want to upgrade it to the latest and also integrate it with Perl but my system is also not supporting the DBI any suggestions please ---(end of broadcast)--- TIP 8: explain analyze is you

Re: [SQL] Scheduling Jobs In PostgreSQL

2004-11-07 Thread Christopher Browne
Martha Stewart called it a Good Thing when [EMAIL PROTECTED] (Chethana Kuloor) wrote: > Is it possbile to schedule jobs in postgres? No. You may schedule jobs using cron. -- select 'cbbrowne' || '@' || 'ntlug.org'; http://linuxfinances.info/info/spiritual.html "If you were to implement this i