gpt4 book ai didi

sql - 问(kdb): nested where query

转载 作者:行者123 更新时间:2023-12-02 11:20:13 29 4
gpt4 key购买 nike

Q 中,有哪些方法可以在 where 子句中使用嵌套查询的结果?

我正在寻找类似于 SQL 语句的内容。

select from food where type_id in (
select type_id from types where type_name = "fruit"
)

最佳答案

select from food where type_id in (exec type_id from types where type_name like "fruit")

除了传递给 in 谓词并使用 like 函数实现字符串相等性的查询之外,您的查询几乎是正确的。当它只接受列表时,您正在传递一个表。为了将查询作为列表发送,我使用 exec 来完成这项工作。

关于sql - 问(kdb): nested where query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6725792/

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