gpt4 book ai didi

sql - 错误 : syntax error at or near "select"

转载 作者:搜寻专家 更新时间:2023-10-30 23:11:08 24 4
gpt4 key购买 nike

这段代码给了我一个ERROR: syntax error at or near "select"

SELECT name_one, name_two, jaro(
select name from clients limit 50 as name_one,
select name from clients limit 50 as name_two
);

这很好用:

select jaro('aaa','aaa');

但是现在我需要从表中获取数据

最佳答案

以下是您可以为所有名称对选择 jaro(name1, name2) 的方法:

SELECT
t1.name as name1
, t2.name as name2
, jaro(t1.name, t2.name) as jaro
FROM
(select name from clients limit 50) t1
CROSS JOIN
(select name from clients limit 50) t2

此查询使用所谓的 self cross join - 它从您的 clients 表中生成所有名称对。

关于sql - 错误 : syntax error at or near "select",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20099442/

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