Adaptive Server Anywhere 是否不支持 FROM 子句中的子查询?
我正在尝试对 Adaptive Server Anywhere 数据库执行 SQL 查询。如下:
SELECT count(*) AS s
FROM (
SELECT column1, count(*) AS n
FROM table1
GROUP BY column1
HAVING n > 1
)
在子查询中,我想要获取所有重复的行,在外部查询中我想要重复的行的计数。
但每当我在 FROM 子句中使用子查询时,数据库就会显示语法错误。这是不支持的吗?
我正在 Powerbuilder 中的交互式 SQL 中执行查询。我使用 ODBC 连接到我的数据库。
I am trying to execute an SQL query on an Adaptive Server Anywhere database. Here it is:
SELECT count(*) AS s
FROM (
SELECT column1, count(*) AS n
FROM table1
GROUP BY column1
HAVING n > 1
)
In the subquery, I want to get all the rows that are duplicates and in the outer query I want a count of the rows that are duplicates.
But the database says that I have a syntax error whenever I use a subquery in the FROM clause. Is this not supported?
I am executing the query in interactive SQL in Powerbuilder. I am connected to my database using ODBC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对Adaptive Server一无所知,但尝试在from语句中为子查询添加别名,如下所示:
MSSQL需要这个才能工作,也许AS也需要它。
I dont know anything about Adaptive Server, but try to add alias for the subquery in from statement, like this:
MSSQL needs this to work maybe AS needs it too.
ASA 不支持这样的“内存中”表。您将需要创建一个临时表,然后从那里提取计数。
ASA does not support "in memory" tables like this. You will need to create a temp table and then pull your count from there.