Hello,
I have a question related to usage of alias for tables; here is the scenario;
I have a single table by the name Locations
This table has an columns like ID, Name, ParentID
I need to SELECT something like
ID Name ParentName(Name)
This is done through a query like
SELECT Loc1.ID, Loc1.Name, Loc2.Name
FROM Locations Loc1, Locations Loc2
WHERE
Loc1.ParentID = Loc2.ID
and so... (i.e. a Self Join I guess - simple ain't it)
So I get like
row 1 = 123 - myName - myParentName
I am doing something like;
DataTable dtHotel = new DataTable();
ResultsetFields fields = new ResultsetFields(4);
fields.DefineField(LocationsFieldIndex.ID, 0, "ID", "Locations1");
fields.DefineField(LocationsFieldIndex.Name, 1, "Name", "Locations1");
fields.DefineField(LocationsFieldIndex.Name, 2, "ParentName", "Locations2");
IPredicateExpression filter = new PredicateExpression();
RelationCollection relations = new RelationCollection();
//just a guess
relations.Add(LocationsEntity.Relations.LocationsEntityUsingParentID, "Locations1", JoinHint.Inner);
//you can ignore the rest
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, dtHotel, 10000, null, filter, relations, false, null, null, 0, 0);
return dtHotel;
Doesn't work, what am I doing wrong...?