我正在尝试在Oracle SQL中运行以下查询,但它一直在修复“单行子查询返回多行”的错误。对DESCR254的查询获得了10个结果。
INSERT INTO PS_Z_TREND_NOW_TBL
VALUES(
(SELECT DESCR254
FROM (
SELECT DESCR254
, COUNT(*) AS COUNT
FROM PS_IS_STATS_URLS
GROUP BY DESCR254
ORDER BY COUNT(*) DESC, DESCR254 )
WHERE ROWNUM <= 10), ' ')
PS_Z_TREND_NOW_TBL有两列。我试图在第一列中插入子查询的结果,只是添加&#39; &#39;在第二栏。有谁知道我做错了什么?
答案 0 :(得分:1)
试试这个:
INSERT INTO PS_Z_TREND_NOW_TBL
SELECT DESCR254,' '
FROM (
SELECT DESCR254
, COUNT(*) AS COUNT
FROM PS_IS_STATS_URLS
GROUP BY DESCR254
ORDER BY COUNT(*) DESC, DESCR254
)
WHERE ROWNUM <= 10))