Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Statements 2
Message
De
06/06/2001 05:01:31
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Titre:
SQL Statements 2
Divers
Thread ID:
00515605
Message ID:
00515605
Vues:
47
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform