Skip to content

join syntax #459

@ghost

Description

If we do a join based on the syntax:
select a.id, b.id from mytable a join mytable1 b on a.id=b.id;

We get a single TablewithJoins strcut that shows how the join occurs (see below), but if we do:

select * from mytable a, mytable b where a.id=b.id;
We get two TableWithJoins but there is nothing that says how these two are joined together.. Should these two select statements produce the same TableWithJoin structure?

Here's the output from my tests:

 select a.id, b.id from mytable a join mytable1 b on a.id=b.id;
[TableWithJoins { relation: Table { name: ObjectName([Ident { value: "mytable", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "a", quote_style: None }, columns: [] }), args: [], with_hints: [] }, joins: [Join { relation: Table { name: ObjectName([Ident { value: "mytable1", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "b", quote_style: None }, columns: [] }), args: [], with_hints: [] }, join_operator: Inner(On(BinaryOp { left: CompoundIdentifier([Ident { value: "a", quote_style: None }, Ident { value: "id", quote_style: None }]), op: Eq, right: CompoundIdentifier([Ident { value: "b", quote_style: None }, Ident { value: "id", quote_style: None }]) })) }] }]


select * from mytable a, mytable b where a.id=b.id;
[TableWithJoins { relation: Table { name: ObjectName([Ident { value: "mytable", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "a", quote_style: None }, columns: [] }), args: [], with_hints: [] }, joins: [] }, TableWithJoins { relation: Table { name: ObjectName([Ident { value: "mytable", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "b", quote_style: None }, columns: [] }), args: [], with_hints: [] }, joins: [] }]

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