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.