EDIT: The answers works, but slow down the query a lot. Is there another solution?
I have the following object in my program.
Page haves various TextBlock that haves various Token.
The three are stored in the database in three tables with the same namas of the objects.
I want to know if is possible to recover all the data needed to fill the object in the program with only one query.
I want only one query because I’m using a CURSOR to iterate over all the objects stored in the database.
The database scheme is this:
Page(id, someAttributes)
TextBlock(id,pageId, someAttributes)
Token(textblockId, someAttributes)
Assuming that every Page has at least one Textblock with at least one Token each try
Alternatively (old syntax):
IF it is possible that the above condition is not always true then you need to use
OUTER JOINinstead ofINNER JOIN.