gpt4 book ai didi

java - 如何将带子查询的 SQL 查询转换为 HQL 查询?

转载 作者:行者123 更新时间:2023-12-01 16:04:13 25 4
gpt4 key购买 nike

我想将以下查询转换为 HQL 查询。我该怎么办?

select * from gpsdata where mobileunitid = '2090818044' and gpsdate in (select gpsdate from gpsdata where mobileunitid = '2090818044' ORDER BY gpsdate DESC LIMIT 1 ) and gpsstatus='true'

最佳答案

Query q = session.createQuery("from GpsData " +
"where mobileUnitId = '2090818044' " +
"and gpsDate in " +
"(select gpsDate from GpsData " +
"where mobileUnitId = '2090818044' " +
"ORDER BY gpsDate DESC LIMIT 1) " +
"and gpsStatus='true'");

,应该可以。

关于java - 如何将带子查询的 SQL 查询转换为 HQL 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2995795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com