Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL-Replace based on another table
Message
De
16/11/1999 11:36:20
 
 
À
16/11/1999 11:18:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00291482
Message ID:
00291492
Vues:
17
>Hi guys! Hopefully quick question here.
>
>I have a table, we'll call it primary, and another called (you guessed it :) ) secondary. What I really want to do is:
>
>
>select primary
>replace approved with .f. for all encumb_id in ;
>     (select encumb_id from secondary where noapp = .f.)
>
>
>But I seem to remember that I can't do a replace using an "in" or perhaps it was that you can't use the results of secondary select or something like that.
>
>I was figuring I'd just use a loop. I know that will work. But I wanted to doublecheck this understanding I have because I would have thought the SQL would be faster. That is, if I'm wrong and this can be done. So am I just missing something small or what?
>

Well, the problem is that REPLACE isn't using the SQL syntax. You could do a SQL UPDATE, though:
the template from Help:

UPDATE [DatabaseName1!]TableName1
SET Column_Name1 = eExpression1
  [, Column_Name2 = eExpression2 ...]
  WHERE FilterCondition1 [AND | OR FilterCondition2 ...]]

and a sample based on what you want to do:

UPDATE Primary ;
   SET approved TO .F. ;
 WHERE encumb_id IN ;
       (SELECT encumb_id FROM secondary WHERE ! NoApp)
>Thanks in advance.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform