Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL help...
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00470729
Message ID:
00470736
Vues:
31
Functions whcih can accept an alias do not work as expected. See excerpt from VFP help topic SELECT - SQL:

Be careful when using, in join conditions, functions such as DELETED( ), EOF( ), FOUND( ), RECCOUNT( ), and RECNO( ), which support an optional alias or work area. Including an alias or work area in these functions might yield unexpected results. SELECT doesn't use your work areas; it performs the equivalent of USE ... AGAIN. Single-table queries that use these functions without an optional alias or work area will return proper results. However, multiple-table queries that use these functions — even without an optional alias or work area — might return unexpected results.

Because the record pointer doesn't move in Jan01, it only checks the current record to determine if it is deleted. If it isn't, nothing gets returned. If it is, everything gets returned.

My advice is to break it up into a query and a subquery:
select Jan01.nId from Jan01 where deleted() into cursor c_temp
SELECT Par01.nId, Par01.cName, Jan01.nId, Jan01.cDesc, Jan01.cCode ;
   Par01.nId, Par01.cName, Jan01.nId, Jan01.cDesc, Jan01.cCode ;
   FROM Par01, Jan01 ;
   WHERE Par01.nId = Jan01.nId and Par01.nID in ;
   (select temp.nId from Jan01 temp where deleted())
Haven't tried it so you may have to tweak it alittle.

HTH.

>This seems like it should work but it returns nothing (I know there are deleted records in Jan01 with matching Par01 records). SET DELETED IS OFF
>The object is to find all deleted Jan01 records that have a matching Par01 record. If I remove the DELETED(...) condition it returns all records.
>
>Any ideas or help is greatly appreciated.....
>
>
>SELECT Par01.nId, Par01.cName, Jan01.nId, Jan01.cDesc, Jan01.cCode ;
> FROM Par01, Jan01 ;
> WHERE Par01.nId = Jan01.nId AND DELETED("Jan01")
>
>
>Thanks
>
>Bob
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform