Fetch record from 3 tables which are related to each other through ID I want Show same product with count. OR I want this format table:

| count |cart_id |u_id |prod_id |cart_status |prod_desc     |u_fname|
|-------------------------------------------------------------------|
|  2    |17      |1    |36      |          1 |LG FHD        |ABC    |
|  1    |20      |1    |22      |          1 |Apple mean    |ABC    |
|  1    |19      |1    |38      |          1 |NOKIA 3       |ABC    |
|  1    |18      |1    |9       |          1 |Notebook      |ABC    |
|-------------------------------------------------------------------|


I have write this sql query But this query show one row with count 5.

SELECT COUNT(p.prod_id) as qty, c.*, p.prod_desc,u.u_fname 
FROM   t_cart AS c 
INNER JOIN t_product AS p 
ON     (c.prod_id=p.prod_id) 
INNER JOIN t_users as u 
on     (c.u_id = u.u_id) 
WHERE  c.u_id = 1


I have table:

     -------------------------------------------------------------
     |cart_id |u_id |prod_id |cart_status |prod_desc     |u_fname|
     -------------------------------------------------------------
     |17      |1    |36      |          1 |LG FHD        |ABC    |
     |16      |1    |36      |          1 |LG FHD        |ABC    |
     |20      |1    |22      |          1 |Apple mean    |ABC    |
     |19      |1    |38      |          1 |NOKIA 3       |ABC    |
     |18      |1    |9       |          1 |Notebook      |ABC    |
     -------------------------------------------------------------
JOINing is done before COUNTing.  That is, it gets 5 (or whatever) rows after joining, but 5 is not the value you wanted.

Instead, use a subquery to get the COUNT(*).