gpt4 book ai didi

SQL 到 HQL 'start with' 和 'Connect by Prior'

转载 作者:行者123 更新时间:2023-12-02 13:52:37 25 4
gpt4 key购买 nike

我需要找到一种方法来获取从 11 开始的 id,在 sql 中使用“start with”和“Connect by prior”,但在 HQL 中,我该怎么做?,如果 grails 中有更好的方法,帮助会很棒,谢谢!

(更新:对不起,我没有写另一个命令:'connect by prior')

最佳答案

假设 ID 是一个字符串,为什么不简单地使用 like 子句:

where id like '11%'

假设它不是字符串,您可以将其转换为字符串:
where cast(id as STRING) like '11%'

或者
where str(id) like '11%'

关于SQL 到 HQL 'start with' 和 'Connect by Prior',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12589260/

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