Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>I got a feeling this isn't possible, but I thought I'd ask just in case. I want to do something like this:
>>
>>SELECT trips
>>DELETE ALL FOR trips.client_num NOT IN (SELECT client_num FROM clients)
>>
>>Basically, there's a lot of orphaned trips in the table and I want to clear them out. Is there any way to do that short of scanning through the trips table and looking up each client_num?
>>
>>Thanks,
>>
>>-Michelle
>
>Since correlated subqueries are not supported, you could set a relation from the child table into the parent, then delete for no match
>
>use parenttable order parentid
>select 0
>use trips
>set rela to parentkey into parenttable
>delete for eof( "parenttable" )
Ok, I'll try that. Thanks.
-Michelle
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement