Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous field in join update #305

Open
kekekeks opened this issue Mar 18, 2014 · 3 comments
Open

Ambiguous field in join update #305

kekekeks opened this issue Mar 18, 2014 · 3 comments

Comments

@kekekeks
Copy link
Contributor

class A
{
     public int Id{get;set;}
     public int UserId {get; set;}
     public string Foo {get; set;
}

class B
{
     public int Id{get;set;}
     public int UserId {get; set;}
     public string Bar {get; set;
}

var q = from a in db.GetTable<A>()
            from b in db.GetTable<B>().Where(x => x.Bar == a.Foo)
            select new { a, b };
q.Update(db.GetTable<A>(), old => new A { UserId = old.b.UserId });

Generated query

UPDATE  `A` `x1` INNER JOIN `B` `x` ON `x`.`Bar` = `x1`.`Foo`
SET
    `UserId` = `x`.`UserId`
An unhandled exception of type 'BLToolkit.Data.DataException' occurred in BLToolkit.4.dll

Additional information: Column 'UserId' in field list is ambiguous
@igor-tkachev
Copy link
Owner

What data provider do you use?

@kekekeks
Copy link
Contributor Author

MySql

@xpoft
Copy link

xpoft commented May 7, 2014

Same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants