Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FoxPro Select query with joins to Sql Server tables?
Message
 
À
10/04/2013 12:33:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01570621
Message ID:
01570646
Vues:
51
>>Get your Jobs and Users into local cursors and then join with them locally.
>
>The Sql Server table 'Jobs' has 43,000 rows in it and I need to join them with a local cursor that has about 8 rows in it to find the 8 matching records in 'Jobs' based on a lookup field.

If the records are some try
lcMatCodeList = ""
SELECT lcCsrMtlRecords
SCAN
    lcMatCodeList = lcMatCodeList + TRANSFORM(mat_code) + ","
ENDSCAN

lcMatCodeList = LEFT(lcMatCodeList, LEN(lcMatCodeList)-1)
TEXT TO lcSql TEXTMERGE NOSHOW 
     SELECT Users.email 
       FROM  Users
       INNER JOIN Jobs On Jobs.quoted_by = Users.emp_num AND Jobs.job_num IN(<<m.lcMatCodeList>>)
       WHERE qty_recd <> before_qty_rec
       ORDER BY 1
       GROUP BY 1
ENDTEXT

lnRes = SQLEXEC(lnSqlHandle, lcSql, "crsTemp")

BROWSE NORMAL
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform