Hi,
I am using query definition which contains multiple tables having the join.
var queryDefinition = new QueryDef
{
Tables = @"dbo.Table1 table1
LEFT JOIN dbo.Table2 table2 ON table1.ID = table2.Table1ID
LEFT JOIN dbo.Table3 table3 ON table2.ID = table3.Table2ID",
WhereClause = $"table1.Name = {name}"
};
What is the meaning of this error? I am not able to understand.
@Wolf @UmaHarano @GKmieliauskas @Aashis
Thanks!
Hi,
I think problem is related with query definition string. Have you tried to specify fields directly (without table1, table2, table3)?
@GKmieliauskas No I cant do that since I have same name columns in those tables.
I mean write string like below:
var queryDefinition = new QueryDef
{
Tables = @"dbo.Table1
LEFT JOIN dbo.Table2 ON dbo.Table1.ID = dbo.Table2.Table1ID
LEFT JOIN dbo.Table3 ON dbo.Table2.ID = dbo.Table3.Table2ID",
WhereClause = $"dbo.Table1.Name = {name}"
};
Another one thing that "WhereClause" doesn't know about "table1", which is defined in "Tables" string.
@GKmieliauskas Now I have included the database name as well since without that I am getting table not found. But after adding database name I am getting
ArcGIS.Core.Data.Exceptions.GeodatabaseEnterpriseException: 'The specified attribute column does not exist.'
Even if all the columns mentioned in the sub fields are present in the table.
var queryDefinition = new QueryDef
{
Tables = @"dbname.dbo.Table1
LEFT JOIN dbname.dbo.Table2 ON dbname.dbo.Table1.ID = dbname.dbo.Table2.Table1ID
LEFT JOIN dbname.dbo.Table3 ON dbname.dbo.Table2.ID = dbname.dbo.Table3.Table2ID",
SubFields = "dbname.dbo.Table1.Id, dbname.dbo.Table1.Name"
WhereClause = $"dbo.Table1.Name = {name}"
};
Sorry, without database I can't help you.
Try to comment SubFields and WhereClause properties, then uncomment one by one and check how it works
@RITASHKOUL Please refer to the snippets page on setting query defn with Joins.