Subject | Re: [ib-support] stored proc question with 2 updates |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2002-09-05T10:03:39Z |
Alan,
the first part of your procedure makes no sense. First you take Farm_Code
and multiply by Gbp Per Load and then count them?? You probably need to do
this differently, e.g. by doing a FOR SELECT and then do the necessary
calculations on a per record basis.
As for your second question - you have no where clause in your updates, so
you are asking for all records to be updated twice in this procedure. You
should probably add a WHERE EXISTS clause duplicating quite a bit from your
subselect.
HTH,
Set
At 05:13 05.09.2002 -0400, you wrote:
the first part of your procedure makes no sense. First you take Farm_Code
and multiply by Gbp Per Load and then count them?? You probably need to do
this differently, e.g. by doing a FOR SELECT and then do the necessary
calculations on a per record basis.
As for your second question - you have no where clause in your updates, so
you are asking for all records to be updated twice in this procedure. You
should probably add a WHERE EXISTS clause duplicating quite a bit from your
subselect.
HTH,
Set
At 05:13 05.09.2002 -0400, you wrote:
>Hi
>I have a problem at the moment in updating a single field in a table. This
>is a monetary value based on EITHER the rate per load x # of loads OR the
>rate per tonne x total tonnes.
>The rate per tonne version works perfectly, but the rate per load always
>gives the # of loads as the value - this is a problem with Count(....) The
>second problem is that all the values for the Rates per Load Hauliers are
>set to 0 when the second part of the SP runs.
>Any suggestions please?