Skip to content

Condition for function join() support #123

Answered by billy1624
Makiras asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Makiras, I guess what you want is something like this?

let query = Query::select()
    .column(Char::Character)
    .table_column(Font::Table, Font::Name)
    .from(Char::Table)
    .join(
        JoinType::RightJoin,
        Font::Table,
        Expr::tbl(Char::Table, Char::FontId)
            .equals(Font::Table, Font::Id)
            .and(Expr::tbl(Char::Table, Char::FontId).equals(Font::Table, Font::Id))
            .and(Expr::tbl(Char::Table, Char::FontId).equals(Font::Table, Font::Id)),
    )
    .group_by_columns(vec![(Char::Table, Char::Character)])
    .to_owned();

assert_eq!(
    query.to_string(MysqlQueryBuilder),
    [
        r#"SELECT `character`, `font`.`name`"#,
        

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tyt2y3
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #108 on September 02, 2021 03:39.