Q: How can I total up 3 select statement count? I have three select statements as follows and I would like to sum up total number of records. How can I do that?
SELECT COUNT(*) AS Number FROM tableA where user_id = 5   //Total 5 records
SELECT COUNT(*) AS Number FROM tableB where user_id = 5   //Total 6 records
SELECT COUNT(*) AS Number FROM tableC where user_id = 5   //Total 1 records

so return result will be 12.

A: You could apply count(*) to the result of a union all:
SELECT COUNT(*)
FROM   (SELECT user_id FROM tablea
        UNION ALL
        SELECT user_id FROM tableb
        UNION ALL
        SELECT user_id FROM tablec) t
WHERE  user_id = 5


A: I think this should do the trick:
SELECT SUM(Number)
FROM (
    SELECT COUNT(*) AS Number FROM tableA where user_id = 5
    UNION ALL
    SELECT COUNT(*) AS Number FROM tableB where user_id = 5
    UNION ALL
    SELECT COUNT(*) AS Number FROM tableC where user_id = 5
)


A: select ( select count(*) from tableA where user_id = 5 )
     + ( select count(*) from tableB where user_id = 5 ) 
     + ( select count(*) from tableC where user_id = 5 ) 
     as total_rows
from dual

