From: | "Joel Fradkin" <jfradkin(at)wazagua(dot)com> |
---|---|
To: | 'KÖPFERL Robert' <robert(dot)koepferl(at)sonorys(dot)at>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: trying to do an update a bit confused. |
Date: | 2005-04-19 16:57:28 |
Message-ID: | 000001c54500$df3c1360$797ba8c0@jfradkin |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I am not updating 1 record.
I have : WHERE m.caseid = tblcase.caseid AND m.clientnum::text =
tblcase.clientnum::text)
Which should do the aggregate on the record that is being updated (least as
I understood it).
It should update all record in case with either 0 if there are no
merchandise records or do a sum of the merch records for the case being
updated.
Joel
I also never heard back on the merge join issue (why do I need to specify
them off on one machine and it runs faster on the other).
I am guessing it is memory related and config related, but I am about to
give up on postgres as I am just not getting all my views to run fast
enough.
You guys could say my views are bad SQL design etc, but they run fine in
MSSQL. I dont mind visiting each one to make them better, but I am just not
able to increase the speed on all of them. The last one about assoc finally
did run in 3 secs with merge joins off which is pretty fast, but now I have
others that seem pretty simple to me and yet run very slow.
You're most probably missing a Where clause after the parentensis. see:
-----Original Message-----
From: Joel Fradkin [mailto:jfradkin(at)wazagua(dot)com]
Sent: Dienstag, 19. April 2005 16:06
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] trying to do an update a bit confused.
update tblcase set merchandisetotal =
(
COALESCE(( SELECT sum(m.quantity::numeric * m.amount) AS merchandiseamount
FROM tblmerchandise m
WHERE m.caseid = tblcase.caseid AND m.clientnum::text =
tblcase.clientnum::text), 0.0)
)
WHERE <condtion that selects one record>;
I tried running the above and it wants to do a sum on all the records in
tblcase instead of just the one being updated, what am I doing wrong?
Joel Fradkin
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2005-04-19 17:43:02 | Re: tsearch2 |
Previous Message | Muhyiddin A.M Hayat | 2005-04-19 16:47:59 | Debet-Credit-Balance Calculation |