-
SQL Server : update command with subqueries
Hello everybody.
I wrote an SQL update query for SQL Server 2000 but found it not fast enough. The query is :
UPDATE mesures SET valeur=valeur*0.12516 WHERE champ_id in (select C.id from graphique G LEFT join champs C ON C.graphique_id=G.id WHERE G.extracteur='R30') AND instant_id in (select id from instant_mesure where jour>=20030301 and jour<20040509)
The 2 SELECT sub-queries are very fast but the UPDATE 'total' query is too slow and I sometimes have a timeout while executing with ODBC. Note that 'mesures.champ_id' and 'mesures.instant_id' are the primary key of the 'mesures' table.
Do you think it can be wroten using another faster syntax ?
Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|