Skip to content

Join doesn't work #5

@MBulli

Description

@MBulli

Hi,

given the following Tables:

CREATE TABLE TestA
(
    ID INTEGER PRIMARY KEY,
    Txt TEXT
);

CREATE TABLE TestB
(
    ID INTEGER PRIMARY KEY,
    Aref INTEGER,
    Txt TEXT,

    FOREIGN KEY(Aref) REFERENCES TestA(ID)
);

INSERT INTO TestA
VALUES (1, 'This is Test A!');

INSERT INTO TestB
VALUES (1, 1, 'This is TestB!');

This line fails:

db["TestB"].Find(db["TestB"]["TestA"]["ID"] == db["TestB"]["Aref"])

The generated SQL statement:

select [TestB].* from [TestB]  JOIN [TestA] ON ([TestA].[Aref] = [TestB].[ID]) where [TestA].[ID] = [TestB].[Aref]

As far as I can tell the tables in the ON part are inverted.
I tested it with: Simple.Data.Core/Ado v0.12.2.2 and Simple.Data.Sqlite v0.12.2.4.

I also checked the behavior of the sqlserver which is doing it right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions