Table aliases

Posts   
 
    
Darren166
User
Posts: 41
Joined: 30-Jan-2007
# Posted on: 15-Mar-2007 18:46:54   

I have a CategoryDAO which I want to use to create a datatable, however the SQL expression I am creating is like so;

select b.Category from categories a inner join products p on a.CatId = p.CatId inner join categories b on a.catpath like b.catpath

forget the query for now, but notice that I want to select a field from the second use of the category table. I can do this if I create a dynamic list by setting the fields entityalias. However if I create a dynamic list I am basically recreating my category fields which seems an extra step and also prone to error due to the use of strings as field names

e.g. fields.DefineField(CategoryFields.CategoryId, 0, "CategoryId", "b");

What I would ike is to just use the CategoryDAO in the first place but somehow specify that it use an entity alias for its fields.

Is this possible?

Thanks,

Darren.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 16-Mar-2007 04:47:07   

Can you post how you're currently using your dynamic list and how you would like to use the DAO instead. It may help to give clarify the situation for me a bit.