如何在QueryDsl中实现左外连接或右外连接

时间:2016-10-07 16:05:35

标签: sql outer-join querydsl

如何在 library(dplyr) library(zoo) DF = structure(list(Date = c("Jan-13", "Jan-13", "Jan-13", "Jan-13", "Jan-13", "Jul-14", "Jul-14", "Oct-16"), Price = c(100L, 200L, 300L, 1000L, 400L, 150L, 50L, 600L), Average.by.Date = c(400L, 400L, 400L, 400L, 400L, 100L, 100L, 600L), Moving_Average_Size_2 = c(NA, NA, NA, NA, NA, 250L, 250L, 350L)), .Names = c("Date", "Price", "Average.by.Date", "Moving_Average_Size_2"), class = "data.frame", row.names = c(NA, -8L)) 中实施Leftright outer join。一个简单的例子是有帮助的。

1 个答案:

答案 0 :(得分:0)

为此,您应该使用leftJoin方法。 E.g:

queryUtil
    .createJpaQuery()
    .from(t1)
    .leftJoin(t1.t2, t2)
    .fetchJoin()
    .where(t2.a.eq(t1.t2.a))
    .fetchAll()