Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow aliases in arrayref table join syntax #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akarelas
Copy link

Summary

In the arrayref syntax of table joins, I allow table names to appear with aliases, like so:

$db->select([
    \'people AS parents',
    [\'people AS children', 'children.parent_id' => 'parents.id'],
]);

Motivation

This change is necessary, in order to allow a table to join itself in a query. Without this change, one would have to write a long SCALARREF instead of the arrayref syntax, like so:

$db->select(\'people AS parents JOIN people AS children ON (children.parent_id = parents.id)');

References

#3

@akarelas akarelas closed this Sep 24, 2023
@akarelas akarelas reopened this Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant