gpt4 book ai didi

sql - 创建表但返回 "too many value"错误

转载 作者:行者123 更新时间:2023-12-01 21:55:24 25 4
gpt4 key购买 nike

我正在使用以下代码创建一个表,我没有太多列,但仍然出现错误

Create table corrYear as
Select a.Symbol ASymbol,b.Symbol BSymbol, corr(a.logp,b.logp) Correlation
From logprofitDEC a join logprofitDEC b
on a.Tdate=b.Tdate
where a.Symbol>b.symbol
And a.symbol in (select asymbol,bsymbol from pairDec1st2nd)
And b.symbol in (select asymbol,bsymbol from pairDec1st2nd)
And To_date(a.Tdate,'YYYYMMDD') between DATE'2013-01-01' AND DATE'2013-12-31'
And To_date(a.Tdate,'YYYYMMDD') between DATE'2013-01-01' AND DATE'2013-12-31'
group by a.symbol,b.Symbol;

错误是

00913.00000-"too many values"

不知道为什么,一般是列太多造成的。请问该怎么办?

最佳答案

我的猜测是这些行导致了错误:

And  a.symbol in (select asymbol,bsymbol from pairDec1st2nd)
And b.symbol in (select asymbol,bsymbol from pairDec1st2nd)

在这两种情况下,子选择都会返回两列,其中应该只有一列,如下所示:

And a.symbol in (select asymbol from pairDec1st2nd)
And b.symbol in (select bsymbol from pairDec1st2nd)

如果我记得正确的话,Oracle 允许在 IN 谓词中使用多个列,如下所示:

And (a.symbol, b.symbol) in (select asymbol,bsymbol from pairDec1st2nd)

虽然我不确定最后一个。

关于sql - 创建表但返回 "too many value"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28789208/

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