英文:
How can i convert the following sql statement to QueryDsl in java?
问题
我尝试从Java代码中使用QueryDSL。但是,在使用带有多个选择子句中的列的内部查询时,我无法访问指定的列。例如r.maxTime
。
FROM (
SELECT Train, MAX(Time) as MaxTime
FROM TrainTable
GROUP BY Train
) r
INNER JOIN TrainTable t
ON t.Train = r.Train AND t.Time = r.MaxTime```
<details>
<summary>英文:</summary>
I tried to use querydsl from java code. but when using inner query with more the on column in select clause, I cant approach to specified columns. ```r.maxTime``` for example.
```SELECT t.Train, t.Dest, r.MaxTime
FROM (
SELECT Train, MAX(Time) as MaxTime
FROM TrainTable
GROUP BY Train
) r
INNER JOIN TrainTable t
ON t.Train = r.Train AND t.Time = r.MaxTime
</details>
专注分享java语言的经验与见解,让所有开发者获益!
评论