Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding SQL Select
Message
 
 
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
Divers
Thread ID:
01385138
Message ID:
01385221
Vues:
47
Hi Naomi,

My problem was that my LEFT JOIN was missing a simple expression like Field = uVaraible, which Tamar noticed and correctly suggested. My WHERE condition has a subquery similar to what you wrote in this reply. First I thought that I needed to move the subquery to the LEFT JOIN but it is not necessary. I am going to test the changes again today to be sure I am not missing something.

You are correct, we did discuss this issue some months ago. And I thought I had a solution back then. But a few days ago, when a certain set of data came across, I found a problem with the logic. Adding SUBQUERY to the WHERE clause, so far, seems to resolve the issue.

I don't know what to be impressed more: with your intuition to see in the past or with Tamar's such a sharp eye that she noticed something in seconds whereas I struggled with the problem for hours yesterday. I am glad I always find myself in a group of smart women :).

Thank you.

>Hi Dmitry,
>
>You can use the where condition on the second table and use it as a derived table, e.g.
>
>select * from myTable LEFT JOIN (select * from mySecondTable where ...) mySecond ON ...
>
>BTW, I have a strange feeling we discussed the same problem already with you. Did I dream out about it? Sometimes I have dreams that happen in the real life later...
>
>>Hi,
>>
>>Here is a pseudo SQL Select statement:
>>
>>
>>select field1, field2, ... from Table1 left join Table2 on Table1.fieldX = Table2.fieldX where (Long Expression)
>>
>>
>>From running this type of SQL Select and analyzing results, it seems to me that VFP will first do the LEFT JOIN and then apply the WHERE condition to the resulting query. Is this correct?
>>
>>My question is, how do you make the SQL Select to select records from Table1 based on the Long Expression and then LEFT JOIN the resulting query?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform