Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update more limited than select?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01291690
Message ID:
01292023
Vues:
27
>>>>This works
>>>>
>>>>SELECT * FROM mytable where;
>>>> f1 in (SELECT f1 from look_up group by f1 having count(*) = 1) AND ;
>>>> f2 in (select f2 from look_up group by f2 having count(*) = 1)
>>>>
>>>>
>>>>and this fails
>>>>
>>>>update mytable set flag = "1" where;
>>>> f1 in (SELECT f1 from look_up group by f1 having count(*) = 1) AND ;
>>>> f2 in (select f2 from look_up group by f2 having count(*) = 1)
>>>>
>>>
>>>And you are very sure that the SELECT returns correct record but UPDATE didn't update all of them?
>>>What happens with this:
>>>
>>>update mytable set flag = "1";
>>>FROM mytable;
>>> where f1 in (SELECT f1 from look_up group by f1 having count(*) = 1) AND ;
>>>       f2 in (select f2 from look_up group by f2 having count(*) = 1)
>>>
>>
>>the select works fine, the update give the error "sql statement too complex"
>
>What version of VFP?
>How about (Just in case you use VFP9):
>
>update mytable set flag = "1";
>       FROM mytable;
>INNER JOIN (SELECT f1 from look_up group by f1 having count(*) = 1) Tbl1 ON MyTable.F1 = Tbl1.F1
>INNER JOIN (SELECT f2 from look_up group by f2 having count(*) = 1) Tbl2 ON MyTable.F2 = Tbl1.F2
>
He-he <g> That's what I suggested in the first place (was a bit lazy to write the whole thing, though).
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform