Re: [SQL] SUM() & GROUP BY

2004-05-06 Thread Martin Kuria
Hi again I have two tables I would like to query i.e. service table and division table SELECT s.pd_geo, COUNT(s.pd_geo) FROM ser s GROUP BY s.pd_geo; OUTPUT: pd_geo | count -- 1| 49 2| 39 3|6 4|54 SELECT d.divisions_name, d.divis

Re: [SQL] Subselect returning 2 columns

2004-05-06 Thread Tom Lane
Francesc Leveque <[EMAIL PROTECTED]> writes: > Is correct to do something like?: > SELECT row1,row2 FROM mytable > WHERE (row1,row3) IN > (SELECT row1 as p1,MAX(row3) as p2 FROM mytable > WHERE row3 <= current_date > GROUP BY row1) Sure. > I mean, I don't see documentation about subselects retur

[SQL] Subselect returning 2 columns

2004-05-06 Thread Francesc Leveque
Hello, Is correct to do something like?: SELECT row1,row2 FROM mytable WHERE (row1,row3) IN (SELECT row1 as p1,MAX(row3) as p2 FROM mytable WHERE row3 <= current_date GROUP BY row1) I mean, I don't see documentation about subselects returning more than one column, but it seems to work... Thanks,

Re: [SQL] not really SQL but I need info on BLOBs

2004-05-06 Thread Andrei Bintintan
Now of corse it depends on the application that you are making, where you put the files. In my situation it is not so complicated, because we're not working on the images, so from this point of view they are "readonly". Out clients that are asking for photos have webaccess to a folder where we put

Re: [SQL] new and old as parameter in a function

2004-05-06 Thread Tom Lane
"Riccardo G. Facchini" <[EMAIL PROTECTED]> writes: > By Reading the documentation, I understand that I can write a PLPGSQL > function that receives a parameter of type RECORD, You misread it --- that's not presently supported. regression=# create function foo(record) returns int as ' regression'#

Re: [SQL] not really SQL but I need info on BLOBs

2004-05-06 Thread Andrew Sullivan
On Thu, May 06, 2004 at 04:46:22AM -0700, Theodore Petrosky wrote: > Thanks for the reply. Are there (in your opinion) > reasons why you would choose to store the images in > the db? Transactional integrity. If there's a risk that people are going to be deleting, &c. these images, then you can e

[SQL] new and old as parameter in a function

2004-05-06 Thread Riccardo G. Facchini
Hi. I'm having some trouble, and I would like to receive some input by the pg community... I would like to write a failry complex PLPGSQL trigger that calls a secondary function. The trigger calls the function with the NEW record that returns a variable of type RECORD whith the NEW variable modif

Re: [SQL] not really SQL but I need info on BLOBs

2004-05-06 Thread Theodore Petrosky
Thanks for the reply. Are there (in your opinion) reasons why you would choose to store the images in the db? My feelings are that it comes down to access. If I store the images in the db, my only access to these images is to retrieve the image do some work on it and reupload it. If I store the im