Skip to content

Specify ON column for leftJoin() #7891

Open
@AntoniusGolly

Description

@AntoniusGolly

I want to do a query like this

SELECT 
	pm.id AS projectMemberId,	
	a.email,	
	c.id,
	c.account_id
	
FROM project_member pm

INNER JOIN account a ON pm.account_id = a.id

LEFT JOIN contact c ON a.email = c.email

The point is, the LEFT JOIN is not done on the id columns of account and contact. I am aware of WITH to specify further conditions. But in my case, I don't have further conditions to the join on id, but I only have the condition on join on email.

It seems very obvious to do but I can't find the solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions