Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SPT Syntax
Message
 
À
26/05/2011 10:38:54
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01511825
Message ID:
01511860
Vues:
35
>I am back with another SPT issue. I have the following SQL to get the latest date from a set of related tables but I need the record index number and table that actually produces the result.
>
>
>
>testconnString = "Select MAX(iDate) As iDate From (Select MAX(idate) As iDate From webprddt7.qms8dprevn Where edindex = 870871 And editeratn = 2" +;
>" Union All Select MAX(idate) As iDate From webprddt7.qms8dcntrl Where edindex = 870871 And editeratn = 2" +;
>" Union All Select MAX(idate) As iDate From webprddt7.qms8dvers1 Where edindex = 870871 And editeratn = 2" +;
>" Union All Select MAX(idate) As iDate From webprddt7.qms8dpca Where edindex = 870871 And editeratn = 2" +;
>" Union All Select MAX(idate) As iDate From webprddt7.qms8dica Where edindex = 870871 And editeratn = 2) td"
>
>
Use TEXT ENDTEXT in VFP when you build your string.
That will make your code more readable.
TEXT TO testconnString  NOSHOW
Select MAX(iDate) As iDate 
From (Select MAX(idate) As iDate From webprddt7.qms8dprevn Where edindex = 870871 And editeratn = 2
      Union All
      Select MAX(idate) As iDate From webprddt7.qms8dcntrl Where edindex = 870871 And editeratn = 2
      Union All
      Select MAX(idate) As iDate From webprddt7.qms8dvers1 Where edindex = 870871 And editeratn = 2
      Union All 
      Select MAX(idate) As iDate From webprddt7.qms8dpca   Where edindex = 870871 And editeratn = 2
      Union All
      Select MAX(idate) As iDate From webprddt7.qms8dica   Where edindex = 870871 And editeratn = 2) td
ENDTEXT 
About your request, what if you have the same date in several tables?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform