Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL FROM SQL
Message
 
 
À
22/01/2009 08:19:00
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01375790
Message ID:
01376357
Vues:
19
This message has been marked as a message which has helped to the initial question of the thread.
>Related question. After a record has been added to Covr table, there is no corresponding InsCarr record at that point. My SQL is only returning 2 records because
>it's looking at InsCarr matches and that's all it finds. How can I get all three records from Covr regardless of what is in InsCarr?
>
>SELECT Seq,CarName,Rec ;
>	FROM InsCarr ;
>	JOIN (SELECT PADL(Seq_Num,4,'0') AS Seq,RECNO() AS Rec,cvCarr ;
>		FROM covr WITH (BUFFERING=.T.) ;
>		WHERE Pat_No=Patient.PtPn AND CvPS=THISFORMInsuranceLevel AND ! DELETED() ) Covr ;
>		ON InsCarr=cvCarr ;
>	ORDER BY 1 ;
>	INTO CURSOR SequenceList
>
Looks like you need a right join from InsCarr to this derived table. Or switch the order and make derived first, then InsCarr and use a LEFT JOIN. For some unknown reason I prefer left joins to right joins though they should operate the same.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform