Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter base table and child table
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01532500
Message ID:
01532554
Vues:
23
>>>>>>>Do you want to select fields from the Details table as well? E.g. can you select the same fields (PO Header only) but set SQL statement to use both tables to specify both conditions?
>>>>>>
>>>>>>No, I don't need to select fields from Details table. Just to have it in the SQL Select (as in LEFT JOIN ...). I will have to test it. Your last sentence would be what I am looking for except you put a question mark at the end. Which I interpret that you are not sure (and if you are not who is?! <g>)
>>>>>
>>>>>Yes, that's my style, actually. I'm usually not 100% sure in all my suggestions, so I word them as questions. When I'm 100% sure I most likely will end up with the . at the end.
>>>>
>>>>The test works! I can't thank you enough. I have to do some custom changes but I don't have to redesign my BIZ classes; which is a big help. Btw, my reference to LEFT JOIN above was wrong. I can't do that because the CursorFill has to "see" the same fields as defined in the schema. So I am going to use the sub-query (is it derived query method; again, I am confusing terminology). Basically my SQL Select will be:
>>>>
>>>>
>>>>select A.field1, A.field2... from A where A.pk in (select B.pk from B where B.field1 = 'somevalue')
>>>>
>>>>
>>>>Again, thank you.
>>>
>>>Great it worked! In this query this part is called a subquery. Derived table term is only used when you need to use subquery in the FROM clause, e.g.
>>>
>>>SELECT A.Field1, A.Field2 FROM A INNER JOIN (select B.PK from ...) B ON ...
>>>
>>>The bolded part can be called derived table.
>>
>>Thank you for clarifying. Do you think the syntax I used (above) or your example of derived table is better when your SQL Select should work with either VFP or SQL Server database?
>
>Both will work in SQL Server. I most likely will prefer to use WHERE EXISTS correlated subquery instead of IN (subquery). IN clause and NOT IN has some traps, so I now very rarely use it in my code.

Thank you!
"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
Répondre
Fil
Voir

Click here to load this message in the networking platform