Skip to content

double inner join #15

Closed
Closed
@jemoreno

Description

@jemoreno

When attempting to call \App\Class::allVersions()->find(#); where # is the unique ID from the main table I get an SQL error:

Illuminate\Database\QueryException with message 'SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'email_builders_version' (SQL: select * from email_builders inner join email_builders_version on email_builders.id = email_builders_version.ref_id inner join email_builders_version on email_builders.id = email_builders_version.ref_id and email_builders_version.version = email_builders.latest_version where email_builders.id = 2 and email_builders_version.deleted_at is null limit 1)

Its clear that it creates two inner join statements but I don't know why.

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