Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statements 2
Message
From
06/06/2001 05:01:31
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
SQL Statements 2
Miscellaneous
Thread ID:
00515605
Message ID:
00515605
Views:
46
In the following SQL statement used for a view, both tables “CONTRACTS” and “TITLES” have a common field “CONTRACTNO”.

CREATE SQL VIEW lv_contview AS ;
SELECT Contracts.*, Titles.titleno, Titles.itemno, Titles.authorno,;
Titles.titlename, Titles.paythis, Titles.perc_used, Titles.dateroypai,;
Titles.itemname, Titles.tnotes, Authors.authorname,;
contracts.contractno+titles.titleno+titles.itemno as titno ;
FROM contapp!contracts INNER JOIN contapp!titles;
INNER JOIN contapp!authors ;
ON Titles.authorno = Authors.authorno ;
ON Contracts.contractno = Titles.contractno;
ORDER BY Contracts.contractno

In the Select part of the statement “Contracts.*” ensures that the term “Contractno” is in the result set. If I also added “Titles.Contractno” to the Select section, the result set includes “Contractno_a” and “Contractno_b”, or something similar, in the result set. Thus I omit “Titles.Contractno”, as it has caused me code problems in the past. It seems to work fine, but I am worried about updates. I need to know:

1. Is my thinking correct on duplicate field names? If not, what is the correct syntax for the SQL statement?
2. If the common field is changed, are both tables updated with the change?
3. Are all tables, when combined in a primary business object by an SQL statement in one view updated successfully if the field “DBSETPROP” lines in “VIEWS.PRG” define update .T.?

Thanks Allan Godney.
Next
Reply
Map
View

Click here to load this message in the networking platform