Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

COUNT(*) giving wrong results

Hi all,

     I am facing a very peculiar issue here. Will take it up with the help of queries -

SELECT COUNT(*) FROM table_name WHERE "column_name" = 'elec'

-- this is giving me 2 rows.

SELECT COUNT(*)

  FROM (

       SELECT * FROM table_name WHERE "column_name" = 'elec'

  );   

---this gives 731 rows which is the CORRECT value.

SELECT COUNT(*) FROM (

            SELECT * FROM table_name

              )

WHERE "column_name" = 'elec';

---this also gives 731 rows which is the CORRECT value.

I have no clue what is I am doing wrong here. It is happening for queries with a 'WHERE' clause. I looked at the PlanViz fir these two queries, but could not make anything out of it. Any help would be appreciated

Former Member
Not what you were looking for? View more on this topic or Ask a question