Re: [SQL] SELECT with sum on groups ORDERING by the subtotals

2005-06-15 Thread Gnanavel Shanmugam
I think it will be better to add one more column for subtotal and write an "on before insert" trigger to update the subtotal with sum of total. with regards, S.Gnanavel > -Original Message- > From: [EMAIL PROTECTED] > Sent: Thu, 16 Jun 2005 00:56:42 -0300 > To: pgsql-sql@postgresql.org

[SQL] SELECT with sum on groups ORDERING by the subtotals

2005-06-15 Thread grupos
Hi Guys! I need to make a complex query. I am thinking to use plpgsql BUT I am confused how I can solve this. What I have: CREATE TABLE test ( code varchar(15), description varchar(60), group varchar(10), quant float8, price float8, total float8 ) WITHOUT OIDS; INSERT INTO test (code, d

[SQL] PostgreSQL and Delphi 6

2005-06-15 Thread Postgres Admin
I have a client who wants to use Delphi as a front end to a Database, I would like to use PostgreSQL over MSSQL and have been looking at the psqlodbc project. Will psqlodbc connect with Delphi 6? Basically, I'm wondering if anyone has experience with it? Any help will be appreciated. Thanks, J

[SQL] cursor "" does not exist

2005-06-15 Thread Vsevolod (Simon) Ilyushchenko
Hi, I'm querying a Postgres 8.0.3 database from Java via the 8.0-311 JDBC driver. It mostly works. I ran into the "cursor does not exist" problem, but was able to fix it with connection.setAutoCommit(false); Or so I thought. There are several JSP pages which still throw the 'cursor "portal 1

Re: [SQL] SELECT very slow

2005-06-15 Thread Thomas Kellerer
PFC wrote on 15.06.2005 22:04: It's not the program or Java. The same program takes about 20 seconds with Firebird and the exactly same data. Hm, that's still very slow (it should do it in a couple seconds like my PC does... maybe the problem is common to postgres and firebird ?)

Re: [SQL] SELECT very slow

2005-06-15 Thread PFC
It's not the program or Java. The same program takes about 20 seconds with Firebird and the exactly same data. Hm, that's still very slow (it should do it in a couple seconds like my PC does... maybe the problem is common to postgres and firebird ?) Try eliminating disk IO by writing a

Re: [SQL] SELECT very slow

2005-06-15 Thread Thomas Kellerer
PFC wrote on 14.06.2005 14:26: [...] Now I fire up python, do a SELECT * from the table and retrieve all the data as native objects... Hm, it takes about 1.3 seconds... on my Pentium-M 1600 laptop... Don't you have a problem somewhere ? Are you sure it's not swapping ? did you ch

Re: [SQL] update syntax

2005-06-15 Thread Bruno Wolff III
On Wed, Jun 15, 2005 at 14:35:42 +0200, Praveen Raja <[EMAIL PROTECTED]> wrote: > Thanks. The UPDATE works ok now. But using the same logic it doesn’t > seem possible to delete rows. Is this also possible? Yes. When you use table names in the where clause they are automatically added to the join

Re: [SQL] Converting varchar to bool

2005-06-15 Thread Bruno Wolff III
On Wed, Jun 15, 2005 at 14:14:46 +0200, KÖPFERL Robert <[EMAIL PROTECTED]> wrote: > Hi, > > > I have currently trouble working with boolean values and variables in > functions. > > As one would expect, a > select '1'::bool, 't'::bool, 'true'::unknown::boolean > > works. > > As a select '1'

Re: [SQL] update syntax

2005-06-15 Thread Bruno Prévost
I don't know if you can do that using the same logic. Perhaps someone else can help?   For sure, you can use a subselect.   delete from table1where col1 in (SELECT a.col1  FROM table1 a JOIN table1 b ON a.col2 = b.col2  WHERE a.col3 = ‘something’   AND

Re: [SQL] update syntax

2005-06-15 Thread Praveen Raja
Thanks. The UPDATE works ok now. But using the same logic it doesn’t seem possible to delete rows. Is this also possible?   /P   -Original Message- From: Bruno Prévost [mailto:[EMAIL PROTECTED] Sent: 15 June 2005 14:22 To: Praveen Raja Cc: pgsql-sql@postgresql.org Subject: Re:

Re: [SQL] update syntax

2005-06-15 Thread Bruno Prévost
Try something like this   UPDATE table1SET col1 = b.col1FROM table1 bWHERE table1.col2 = b.col2 andtable1.col3 = ‘something’ andb.col3 = ‘somethingelse’   - Original Message - From: Praveen Raja To: pgsql-sql@postgresql.org Sent: Wednesday, June 15, 2005 7:39 AM Subje

[SQL] Converting varchar to bool

2005-06-15 Thread KÖPFERL Robert
Hi, I have currently trouble working with boolean values and variables in functions. As one would expect, a select '1'::bool, 't'::bool, 'true'::unknown::boolean works. As a select '1' tells us this seems as a conversion unknown->bool or ??maybe?? a boolean literal?? what-o-ever, at least my

[SQL] update syntax

2005-06-15 Thread Praveen Raja
Hi,   While using Ms SQL server I used to write update statements like this,   UPDATE a SET a.col1 = b.col1 FROM table1 a INNER JOIN table1 b ON a.col2 = b.col2 WHERE a.col3 = ‘something’ AND b.col3 = ‘somethingelse’   But I can’t seem to do this in postgres, it gives me an error