Re: OT: SQL problemby periapt (Hermit)
|on Jan 25, 2005 at 13:55 UTC||Need Help??|
A couple of comments:
1) there is no guarantee that the update is acting on a single record. What should happen if your subquery returns more than one record?
2)in the second update you set the field to a constant based on a table join. The subquery is expensive in terms of time and probably unnecessary
It might be better to calculate the result first then update in one step. This might work
Update: I just noticed the WHERE condition doesn't require Lookup_table. You could simplify the query to a select on Calculation only. It will save you some time on the lookup. You could even incorporate the lookup back into your original query (but then you would lose some error checking)
use strict; use warnings; use diagnostics;