Q: how to get the sum form query result Here is my query. I want to get the sum from reqery result.
SELECT COUNT( user_id ) c
FROM mst_tabs
WHERE merchant_id =3
GROUP BY user_id
HAVING c >1 

This is my query result.I am trying to get the summation of this result.
    c 
--------    
    19
    3
    26
    93
    20
    2
    34
    5

I don't know how to use sum() with this result.

A: Use a subquery:
SELECT SUM(c)
FROM (SELECT COUNT( user_id ) as c
      FROM mst_tabs
      WHERE merchant_id =3
      GROUP BY user_id
      HAVING c > 1 
     ) c;

If you have a unique id in each row, then you can do this without a subquery:
SELECT COUNT(m.user_id ) as c
FROM mst_tabs m
WHERE merchant_id = 3 AND
      EXISTS (SELECT 1
              FROM mst_tabs m2
              WHERE m2.merchant_id = m.merchant_id AND
                    m2.user_id = m.user_id AND m.id <> m2.id);

This may be faster with an index on mst_abs(merchant_id, user_id, id).

A: SELECT sum( c )
FROM (

SELECT COUNT( user_id ) c
FROM mst_tabs
WHERE merchant_id =3
GROUP BY user_id
HAVING c >1
) AS t

Here I have created an alias for table. Then get the sum of that result.
