Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

Join doesn't work #5

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.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions