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

Conditional query after join on is supported. >=,<=,in #780

Closed
lurenjia11083 opened this issue Apr 23, 2024 · 2 comments · Fixed by #842
Closed

Conditional query after join on is supported. >=,<=,in #780

lurenjia11083 opened this issue Apr 23, 2024 · 2 comments · Fixed by #842

Comments

@lurenjia11083
Copy link

SELECT
	seats.id,
	seats.seatname,
	COUNT( user_seats_order.id ) count 
FROM
	seats
	LEFT JOIN user_seats_order ON user_seats_order.seatid = seats.id 
	AND user_seats_order.dueendtime >= '2024-04-23T04:05:11' 
	AND user_seats_order.duestartime <= '2024-04-23T23:05:11' 
	AND user_seats_order.duestatu IN ( 0, 1, 2, 3 ) 
@jeffgbutler
Copy link
Member

This is not supported currently. You will need to put the conditions in a WHERE clause.

@hermer
Copy link

hermer commented Aug 5, 2024

public class GreaterThanOrEqualTo extends JoinCondition {
    public GreaterThanOrEqualTo(BasicColumn rightColumn) {
        super(rightColumn);
    }

    @Override
    public String operator() {
        return ">=";
    }
}
 public static JoinCondition buildJoinCondition(Operate operate, BindableColumn value) {
        if (Operate.GTE.equals(operate)) {
            return new GreaterThanOrEqualTo(value);
        }  
        // ...
    }

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 a pull request may close this issue.

3 participants