Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about joins
Message
 
À
26/08/2007 15:36:20
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, États-Unis
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 9 SP1
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01250511
Message ID:
01250515
Vues:
19
>I am a bit familar with SQL queries, but the Foxpro twist is causing me a few headaches.
>
>I would expect the following query to give me a list of all fields in table a and 1 field in table b, but it renames any of the fields in table a with an _a that conflict with names in the joined table even though I am not questing them.
>
>SELECT *,design.description FROM invitempost INNER JOIN design ON invitempost.descode = design.descode
>
>I don't want to specifically list the fields from table a that I want because there are easily 100 fields in that table and I plan on using this sql statement in many areas and don't want to constantly have to update them. I am sure there is an easy answer.....
>
>-Randy

No Randy,
That query will give you ALL fields from ALL tables involved in the query and the field "description" will be duplicated. And this is true not only for VFP but for SQL Server also (I suspect that for all other RDBMS this is true also, but not sure). If you want all fields from one of the table you must specify its alias:

That query:
SELECT invitempost.*,;
       design.description;
FROM invitempost;
INNER JOIN design ON invitempost.descode = design.descode
Will give you all fields from invitempost table and the Description field from design table.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform