Re: [SQL] SQL syntax extentions - to put postgres ahead in the race

2004-08-05 Thread Stephan Szabo
On Thu, 5 Aug 2004, Ram Nathaniel wrote: > > 1) The operator "of max": > suppose I have a table "grades" of 3 fields: class/student/grade where I > store many grades of many students of many classes. I want to get the > name of the highest scoring student in each class. Note that there may > be m

[SQL] SQL syntax extentions - to put postgres ahead in the race

2004-08-05 Thread Ram Nathaniel
Hi,   I am a developer working with many databases, as a part of my job. I use heavy SQL queries and have become somewhat of an expert in SQL, including tricks and workarounds of the limitation of the language.   I feel like a lot of the workarounds could be avoided with adding a few new ope

Re: [SQL] Trigger and function not on speaking terms

2004-08-05 Thread Kevin Davis
You need to define fn_foo w/o params per Doc Section 19.9. Your intent as expressed in the trigger def (args) can then be fulfilled through special top level vars. On Mon, 2004-08-02 at 16:20, Jeff Boes wrote: > Hmm, this is puzzling me: > > create or replace function fn_foo(text) returns trigger

[SQL] Sum and count weird results

2004-08-05 Thread Michalis Kabrianis
Hi all, I have these tables a ( id integer, email varchar); b ( seat varchar, transactionid varchar); c ( transactionid varchar, totalprice numeric(8.2)); ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] contrib/tablefunc crosstab

2004-08-05 Thread Joe Conway
Caleb Simonyi-Gindele wrote: My problem is that the rows are populated from right to left irrespective of the column. So the $561.99 in vet1 actually belongs to vet2. There are never any blank cells in the middle or start of a row - they always come at the end. How do I get the amount for that date

[SQL] contrib/tablefunc crosstab

2004-08-05 Thread Caleb Simonyi-Gindele
Hi, I am using the crosstab function by Joe Conway and I am having a problem that could be my fault but I'm not sure. My query/result is: atc=# SELECT * FROM crosstab('SELECT cli_tran_trans_date, TRIM(dat_staff_code) AS dat_staff_code, SUM(cli_tran_amount) from vetpmardet WHERE cli_tran_trans_da