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

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • number of rows returned by query
    2004-10-12 04:13:55  dev-1 [View]

    Try the following Query>>

    select count (*)
    from chains where idchain in(
    select idchain from chains
    group by 1
    having count (idchain) > 1
    )
    • number of rows returned by query
      2008-11-17 03:53:11  amit78g [View]

      No. I guess it should be this:

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