Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to solve this SQL Select?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01099608
Message ID:
01099660
Views:
15
>>>Becuase I hate to see in my code:
>>>NVL(Field,0000000.00) AS ...
>>>I use new VFP9 function CAST. No the answer is in how join these tables. I used left join, you only JOIN
>>>That way I get in the result cursor (w/o gouping)
>>>
>>>ID   Tbl2.PK  Tbl2.Sumv  Tbl3.PK    Tbl3.Sumv
>>>1       1       200        2           200
>>>1       NULL    NULL       3           400
>>>
>>>
>>
>>This is where I see different results, not in your example, but my actual code with my tables. When I use LEFT JOIN I see no NULL values in the resulting query. That's what puzzles me. Table2 has only 1 record matching the PK field. Therefore, it should have NULL values in the second record but it doesn't.
>
>You must remove GROUP BY to see them

I did remove the GROUP BY. And I tried to change the order of LEFT JOIN of Table2 and Table3 but still no matter what I do, I see two records in the resulting query. And for the fields of the Table2 these records are identical.
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform