Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie View Designer Join Problem
Message
De
14/08/1998 09:20:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/08/1998 08:56:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00126790
Message ID:
00126869
Vues:
22
>>>No extra function is needed :
>create sql view myview as ;
> select * from table1 ;
>
> inner join table2 ;
> on table1.catalog = table2.catalog<<
>
>Why wouldn't I need to use the SUBSTR function on TABLE1.CATALOG since TABLE1.CATALOG and TABLE2.CATALOG fields are not identical in length?

Good question. If they were just string comparison I would also add "if set exact is off". I assumed (bad habbit) you don't ever set ansi on for exact matches but only use "set exact" or "==".
* String comparison - exact off (also in SQL if field compared to a string var)
? "123456" = "12"       && .t.
? "123456" == "12"      && .f.
? "123456" = "1234567"  && .f.
* String comparison - exact on
? "123456" = "12"       && .f.
? "123456" == "12"      && .f.
? "123456" = "1234567"  && .f.
* SQL - exact on or off doesn't matter
table1         table2 (len-2)
------         ------
123456    =    12        && .t.
123456    ==   12        && .t. - surprise
* Switch table2 = table1 - again .t. - surprise
* ANSI ON - Now things differ
table1.field1 = table2.field2 threaded as if you're doing String1 == String2.
So conclusion :
1) If you don't "set ansi ON" you don't need to try to make them same length for joins.
2) It's most likely you already have indexes on Catalog field. If you want to add another index with substr() then it's up to you. Then you could set your join with substr() and have safety belt against ANSI ON.

Where you would add the join condition in view designer :
open your database and Run the "create SQL view.." in command window. Open designer and see what goes where. Or use View wizard, in some step it would ask for join condition and there generally all you do is to click "add".
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform