ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  SQL Subqueries
Subject:   number of rows returned by query
Date:   2003-08-28 03:42:57
From:   anonymous2
Hi SQL guruz,


I am just a beginner in the SQL and have a little problem.


I have an query which works flawlessly and return the expectant results. It looks like:



select idchain from chains
group by 1
having count (idchain) > 1


Now. I am not interested in the content of the result. I just want to know, how much rows this query will return. I tried to enclose all that query in the other, but it does not work. I get the syntax error instead of count of rows. This what I have tried:



select count (*) from (
select idchain from chains
group by 1
having count (idchain) > 1
)


What I am doing wrong?


Thanks in advance, Roman G., Prague


1 to 1 of 1
1 to 1 of 1