I have the following code that works fine:
await QueuedTask.Run(() =>
{
using (Geodatabase l_myGDB = new Geodatabase(new
FileGeodatabaseConnectionPath(new Uri(<MyGeodatabase>))))
{
QueryDef queryDef = new QueryDef
{
Tables = "People INNER JOIN States ON People.FK_STATE_ID = States.OBJECTID",
SubFields = "People.ObjectID,People.First_Name, People.Last_Name, People.City, State.State_Name",
};
using (RowCursor l_rowCursor = l_laserGDB.Evaluate(queryDef,false))
{
while(l_rowCursor.MoveNext())
{
//Grab all the data....
}
}
But I can't seem to get the syntax correct to LEFT JOIN the previous resulting join with another table. What I want to do is....
await QueuedTask.Run(() =>
{
using (Geodatabase l_myGDB = new Geodatabase(new
FileGeodatabaseConnectionPath(new Uri(<MyGeodatabase>))))
{
QueryDef queryDef = new QueryDef
{
Tables = "((People INNER JOIN States ON People.FK_STATE_ID = States.OBJECTID) LEFT JOIN Homes ON People.OBJECTID = Homes.FK_PEOPLE_ID)",
SubFields = "People.ObjectID,People.First_Name, People.Last_Name, People.City, State.State_Name, People.FK_HOME_ID, Homes.Address",
};
using (RowCursor l_rowCursor = l_laserGDB.Evaluate(queryDef,false))
{
while(l_rowCursor.MoveNext())
{
//Grab all the data....
}
}
These are not exactly my tables names but you get the gist. I'm trying not to duplicate states so that's why the People table as a Foreign Key to the State table. For the third table I want people to be able to own more than one home
I suspect it's how the Tables Property is expected to be formatted but haven't been able to figure it out... as of yet.. Thought someone could point me in the right direction. Documentation I found seems to indicate I should be able to query multiple tables in a single Query. I know I can do this with any standard database outside of ArcGIS Pro just trying to figure out how to do it here. Thanks.