Alias to specify which table to select data from?

Posts   
 
    
paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 23-Nov-2006 16:52:11   

I have a query that joins across 7 tables. The fields i want to retrive are all on one of the joined tables (not the first table just after the FROM clause). Is there a way for me to specify the alias for the joined table?

e.g. what i want is something like: this.Adapter.FetchEntityCollection(itemCollection,"tableAlias", filter, -1, sorter, page, pageSize);

I know i can do this: ResultsetFields fields = new ResultsetFields(1); fields.DefineField(ItemFieldIndex.ItemUrn, 0, "tableAlias");

to specify the exact fields i want, but i want to retrieve the data in an EntityCollection.

Thanks.

paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 23-Nov-2006 18:07:24   

turns out i can't do: fields.DefineField(ItemFieldIndex.ItemUrn, 0, "tableAlias"); it merely defines the name of the field after it is selected from the first table.

So how can i retrieve fields from another table in my query?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 24-Nov-2006 02:52:54   

If you have a join that goes across 7 tables how do you expect it to be one entitycollection? Have you looked at using a prefetchpath? If all of the relations are already defined this may be the best way to retrieve your data.

Are you using inheritance?

If you are looking for just one resultset then you may look at using the dynamic list.

If none of these appear to be helpful then please post more code and a description of what you are wanting it to do, along with the information requested in the Guidelines thread at the top of the forum.