Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Assistance With A Query
Message
De
16/07/2004 22:00:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00925379
Message ID:
00925417
Vues:
11
>Perfect! Thanks!

I wasn't sure whether this answered your question, but since that seems to be the case, let me add a few details.

Reposting my code:
select SchedLine.Length, Details.Type;
  from SchedLine join detail on SchedLine.SchedLineId = Details.SchedLineId
If one of the tables doesn't have an equivalent in the other table, the record won't be included in this example. For instance, suppose some data in the Details table doesn't have a valid SchedLineId number; the record will be omitted. To include all records in the Details table, just change JOIN to RIGHT JOIN (meaning, include all records in the table listed on the right side of the JOIN statement):
select SchedLine.Length, Details.Type;
  from SchedLine right join detail on SchedLine.SchedLineId = Details.SchedLineId
In the example, if a record in Details doens't have an equivalent in SchedLine, the corresponding fields (here: SchedLine.Length) will be .NULL. in the resulting cursor. If you need a valid value, you would usually use nvl(), something like this:
select nvl(SchedLine.Length, 00000), Details.Type;
  from SchedLine right join detail on SchedLine.SchedLineId = Details.SchedLineId
The 5 zeroes are to make sure the field has the correct width (assuming your field is defined as N(5,0)).

BTW, the possibility of an outer join (i.e., using LEFT, RIGHT or FULL in combination with JOIN) is an important reason to use the JOIN syntax, instead of the alternative WHERE (only option up to VFP 3).
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform