Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The Use of * In Sql Select Syntax
Message
De
10/03/2007 08:58:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
10/03/2007 08:49: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 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01202512
Message ID:
01202517
Vues:
10
>Thanks a lot guys for that highlight.
>
>The other hitch is to ensure that the JOIN results in ALL RECORDS in the LEFT JOIN and not just the matched ones.

To include all records from one of the tables, include the LEFT or RIGHT keyword. For example, to select all records from the left table:
select ...;
  from Table1 LEFT JOIN Table2 on ...
In this case, if a record in Table1 has no match in Table2, fields in Table2 will have null values. You can use nvl() to convert this to something useful. For example, let's assume that not all invoices have a client.
select Invoice.*, nvl(Client.ClientName, space(30));
  from Invoice join Client on Invoice.ClientId = Client.ClientId;
  into table Temp
report form ...
In the above example, the client name is replaced with spaces (which should equal the length of the "ClientName" field), for reporting purposes.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform