Closed
Description
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
Labels
No labels