Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the data from one SQL
Message
De
17/11/2005 18:57:13
 
 
À
17/11/2005 17:47:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01070001
Message ID:
01070024
Vues:
26
This message has been marked as the solution to the initial question of the thread.
>When doing it with VFP code, I was using two SQL to obtain the desired data. Basically, I was getting one cursor from unions for the first SQL like this:
>
>
>SELECT NoMaster AS Numero FROM Style;
> UNION SELECT NoMaster2 AS Numero FROM Style;
> GROUP BY 1 INTO CURSOR Temp
>lcInnerJoin='INNER JOIN Temp ON Master.Numero=Temp.Numero'
>
>
>And, then, on the second SQL, I was simply evaluating lcInnerJoin to get the data such as:
>
>
>SELECT Master.Numero,Master.FirstName,Master.LastName,'MasterType.Title_A,MasterType.Title_F,Master.Bio_A,Master.Bio_F,;
> UPPER(Master.LastName) AS LastName2,UPPER(Master.FirstName) AS FirstName2;
> FROM Master;
> INNER JOIN MasterType ON Master.NoMasterT=MasterType.Numero;
> INNER JOIN ON Master.NoMasterT=MasterType.Numero;
> &lcInnerJoin ORDER BY LastName2,FirstName2
>
>
>Now, I need to merge that code into one SQL in order to be compliant with a client server approach for a future expansion to SQL Server. The inner join is not a problem but I am looking for the best approach in regards to the union clause.
SELECT Master.Numero,Master.FirstName,Master.LastName,'MasterType.Title_A,MasterType.Title_F,Master.Bio_A,Master.Bio_F,;
 UPPER(Master.LastName) AS LastName2,UPPER(Master.FirstName) AS FirstName2;
 FROM Master;
 INNER JOIN MasterType ON Master.NoMasterT=MasterType.Numero;
 WHERE Master.Numero IN (SELECT NoMaster FROM Style);
    OR Master.Numero IN (SELECT NoMaster2 FROM Style);
ORDER BY LastName2,FirstName2
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform