Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL question
Message
 
À
13/02/2017 09:08:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01647876
Message ID:
01648115
Vues:
102
Hello:

I have been reading about LEFT JOIN ON. I realize that it is supposed to be easier to read. But I wonder if this:
SELECT Table2.Id ;
FROM Table2 ;
LEFT JOIN Table1 on ( Table1.Id = Table2.Id ) ;
WHERE ( Table1.Id is null)
functions the same as this?
SELECT Table2.Id ;
FROM Table1, Table2 ;
WHERE Table1.Id = Table2.Id .AND. ;
( Table1.Id is null) &&& and, if Yes, then are the ()'s needed in this line?
Or will LEFT INNER JOIN ON be faster than just a WHERE?

Thanks, Steve

>
>select Table2.Id ;
>    from Table2 ;
>   left join Table1 on ( Table1.Id = Table2.Id ) ;
>   where ( Table1.Id is null)
>
>
>>Hi:
>>I have two tables: table1 and table2. Each has one text field in common: ID, containing a 9 character code that is unique for each record. However, whereas table1 has 10,000 records, table2 has 200. But some of the ID's found in table2 do not exist in table 1. Using set relation and filter, I can find the table1 id's that are missing from table2. I am wondering whether this could also be done with an SQL statement?
>>
>>
>>CLOSE ALL
>>USE
>>USE table2
>>INDEX on id TO id2
>>
>>SELECT 2
>>USE table1
>>INDEX on id TO id1
>>
>>SELECT 1
>>SET RELATION TO id INTO table2
>>SET FILTER TO table2.id  == " "  && or == ""
>>SELECT 2
>>DELETE ALL 
>>SET FILTER TO 
>>SET FILTER TO DELETED()
>>BROWSE && for instance
>>
>>
>>I thought that an SQL statement such as the following might be equivalent, but it isn't:
>>
>>
>>SELECT * ;
>>FROM table1, table2 ;
>>WHERE table1.id <> table3.id 
>>
>>
>>Thank you, Steve
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform