Re: [SQL] DIfference between max() and greatest() ?

2008-09-12 Thread Bart Degryse
max(expression) is an aggregate function (from the manual: "maximum value of expression across all input values") greatest(value [, ...]) is not an aggregate function (from the manual: "The GREATEST function selects the largest value from a list of any number of expressions.") So max takes the

Re: [SQL] DIfference between max() and greatest() ?

2008-09-12 Thread Peter Eisentraut
Ruben Gouveia wrote: What is the difference between these two. I know that max() is an aggregate function ... and greatest() is a normal single-row function. One works vertically, one works horizontally, if that helps you. :-) Or max() is like sum() and greatest is like +. -- Sent via pgsql

Re: [SQL] Pls Hlp: SQL Problem

2008-09-12 Thread Richard Huxton
Hengky Lie wrote: > Dear friends, Hello. Quick tip - don't reply to another message when starting a new thread, people will assume it's part of the old thread. [snip most of query] > / 100::numeric * > Food";3960.;*4200.*;*240.* > Why the ca

[SQL] Pls Hlp: SQL Problem

2008-09-12 Thread Hengky Lie
Dear friends, I have problem in postgresql  view.  This is the view (Pay attention to the red and blue colours): SELECT tblpenjualan.tanggal, tblpenjualan."operator", tblpenjualan.noinvoice, tblpenjualan.bayar, tblpenjualan.bayarvocher, tblpenjualan.jam, tblpenjualan.id, tblpenjualan.jeniscar

Re: [SQL] DIfference between max() and greatest() ?

2008-09-12 Thread Ruben Gouveia
Thanks Bart, Your explanation is great. Returned and Bought are of datatypes date, hence Returned would be a more recent value. On Fri, Sep 12, 2008 at 12:10 AM, Bart Degryse <[EMAIL PROTECTED]>wrote: > max(*expression*) is an aggregate function > (from the manual: "maximum value of *expressi

[SQL] Doubts about FK

2008-09-12 Thread Rafael Domiciano
Hi there, In my DB I have a couple of FK, so the change of referenced columns is a quite complicated. Today, I DISABLE TRIGGER ALL on the tables envolved and then ENABLE TRIGGER ALL to back them. Is there a better way to do that? I read something about SET CONSTRAINTS ALL DEFFERED, but I don't kn

Re: [SQL] Pls Hlp: SQL Problem

2008-09-12 Thread Hengky Lie
Dear Richard, Sorry for that :) and thanks for your tips, but it didn't solve my problem. Maybe because my postgresql knowledge limitation. I have tried your suggestion, my view like this : -- View: "vwlapjual" -- DROP VIEW vwlapjual; CREATE OR REPLACE VIEW vwlapjual AS  SELECT tblpenjuala

Re: [SQL] Pls Hlp: SQL Problem

2008-09-12 Thread Scott Marlowe
On Fri, Sep 12, 2008 at 12:50 PM, Hengky Lie <[EMAIL PROTECTED]> wrote: > Dear Richard, > > Sorry for that :) and thanks for your tips, but it didn't solve my problem. > Maybe because my postgresql knowledge limitation. I have tried your > suggestion, my view like this : Put parens around the whol

Re: [SQL] Doubts about FK

2008-09-12 Thread Scott Marlowe
On Fri, Sep 12, 2008 at 12:14 PM, Rafael Domiciano <[EMAIL PROTECTED]> wrote: > Hi there, > > In my DB I have a couple of FK, so the change of referenced columns is a > quite complicated. > Today, I DISABLE TRIGGER ALL on the tables envolved and then ENABLE TRIGGER > ALL to back them. > Is there a

Re: [SQL] Pls Hlp: SQL Problem

2008-09-12 Thread Fernando Hevia
> -Mensaje original- > De: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] En nombre de Scott Marlowe > > On Fri, Sep 12, 2008 at 12:50 PM, Hengky Lie > <[EMAIL PROTECTED]> wrote: > > Dear Richard, > > > > Put parens around the whole thing, like: > > (tbltransaksi.hargapokok * tbltran

Re: [SQL] Pls Hlp: SQL Problem

2008-09-12 Thread Scott Marlowe
On Fri, Sep 12, 2008 at 4:01 PM, Fernando Hevia <[EMAIL PROTECTED]> wrote: > > >> -Mensaje original- >> De: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] En nombre de Scott Marlowe >> >> On Fri, Sep 12, 2008 at 12:50 PM, Hengky Lie >> <[EMAIL PROTECTED]> wrote: >> > Dear Richard, >> > >> >