Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL question
Message
De
19/02/2017 06:26:29
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01647876
Message ID:
01648137
Vues:
87
Think you have to create some sample data - like your Table1 and Table2 - and try some combinations of the joins.
You'll understand

>1. Is "left join" different from "left inner joint" ? (http://stackoverflow.com/questions/5706437/whats-the-difference-between-inner-join-left-join-right-join-and-full-join)
>2. But "You can abbreviate the left outer join language as LEFT JOIN because there’s no such thing as a left inner join: "http://www.dummies.com/programming/sql/how-to-use-the-sql-outer-join/.
>3. More charts at: https://au.pinterest.com/explore/sql-inner-join/.
>4. But, is the real explanation that? "left join" means "left outer join"? from: http://dba.stackexchange.com/questions/74737/left-join-not-working
>5. Above conclusion, also at:
>http://www.forsql.info/what_is_the_difference_between_left_join_and_left_outer_join_duplicate
>
>
>
>>No, it's not the same. You use an inner join which returns records that match
>>
>>To find the records in table2 that do not have a matching key you need an outer join. The 'is null' clause filters the records that do not have a matching key in Table2 - which was your question
>>
>>There's a good visual explanation here https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/
>>
>>
>>
>>>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
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform