Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter base table and child table
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01532500
Message ID:
01532553
Views:
27
This message has been marked as a message which has helped to the initial question of the thread.
>>>>>>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.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform