Christian Magro
Christian Magro

Reputation: 139

How can I sum number of rows of a table in SQL ORACLE?

I have the follow instruction on SQL ORACLE:

SELECT COUNT(FE_DAY)
FROM TI_DATE
WHERE (FE_MO = 02 AND FE_YEAR in ('2011', '2012'))
GROUP BY FE_DAY

In this instruction effectively obtain like SQL Answer a list of number that they sum=10 .But How can I don't show rows .I need only show the row's sum=10

I tried to apply the follow SQL instruction also:

SELECT SUM(COUNT(FE_DAY))
FROM TI_DATE
WHERE (FE_MO = 02 AND FE_YEAR in ('2011', '2012'))
GROUP BY FE_DAY

But the answer was 57, different of the number of rows, that I need.

Upvotes: 0

Views: 1412

Answers (1)

ruakh
ruakh

Reputation: 183241

If I understand correctly what you want, you actually don't need the GROUP BY clause; you can just write:

SELECT COUNT(1)
  FROM ti_date
 WHERE fe_mo = 2
   AND fe_year IN ('2011', '2012')
;

Upvotes: 3

Related Questions