Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The Use of * In Sql Select Syntax
Message
From
10/03/2007 08:58:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
10/03/2007 08:49:09
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01202512
Message ID:
01202517
Views:
12
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform