Skip to content

Update with Joins #637

Description

@SeanLawless

Hi,

Just wondering if it is possible to build a query statement to update a table which includes joins. When using the Update() method it compiles fine but does not include the joins in the compiled query.
Example below :

Query("Table1").Join("Table2", "Table2.Column1", "Table1.Column2").Where("Table2.Column3", 1).Update(new {Column5= 1})

Using the compiler this will compile to the blow :

UPDATE [Table1] SET [Column5] = 1 WHERE [Table2].[Column3] = 1

There is no error shown on compilation but it just ignores the joined table completely when run. Can you please advise on a fix for this? From reading the code version one would expect to see the join in the compiled query.

This should be compiling to the following :

UPDATE [Table1] SET [Column5] = 1 FROM [Table1] JOIN [Table2] ON [Table2].[Column1] = [Table1].[Column2] WHERE [Table2].[Column3] = 1

TIA.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions