Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complicated tree query
Message
 
To
10/10/2006 03:21:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01160753
Message ID:
01161093
Views:
20
>>Hi, Edgar!
>>
>>First of all, try to avoid using the reserved words as the field names
>>
>>
>>USE your_table_name IN 0 ALIAS PARENTS
>>USE your_table_name AGAIN IN 0 ALIAS CHILDS
>>* select all childs from top record
>>GO TOP
>>SELECT Tname FROM CHILDS INTO CURSOR cRelations WHERE childs.pid=parents.id
>>BROWSE nowait
>>
>
>There is no need to open table twice, you could self-join the table:
>
>SELECT ....;
>    FROM TableName Master;
>JOIN TableName Child ON childs.pid=parents.id;
>INTO CURSOR crsTest
>
Hi, Borislav!
Yes, we can use and self-join, but your syntax must be changed
when we want to select just one field
otherwise you will get an error about non-unique field name.
And question was about selection one field under specific condition,
so I think that using one table under two different aliases
is more simple.
WBR,
Juri
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform