mercredi 7 février 2018

Get count of status for particular user

first table :detail

-------------------------------------
S.no  |   j_id  |age | status |
-------------------------------------
 1    |     1   |32  |  1     |
-------------------------------------
-------------------------------------
 1    |     1   |32  |  1     |
-------------------------------------
-------------------------------------
 1    |     2   |32  |  1     |
-------------------------------------
-------------------------------------
 1    |      2   |32  |  2     |
-------------------------------------
-------------------------------------
 1    |     1   |32  |  3     |
-------------------------------------
-------------------------------------
 1    |     3   |32  |  1     |
-------------------------------------

Here 1=Active 2=Inactive 3=pending

2nd table i have : mine

---------------------------------
S.no  | Name |  lname     |age |  
---------------------------------
 1    | ankit|     nath   |32  |  
--------------------------------
---------------------------------
 2    | neha |     nath   |32  |  
--------------------------------
---------------------------------
 3    | neraj|     nath   |32  |  
--------------------------------

Here i have two table i want the status count for particular name

like i have Name ankit i want ankit active count is:2 ankit Inactive count is:0 and pending count is:1 result should be like that .. for all the mine table name how can i acchieve this in mysql and in laravel DB:select through help me related this thanx in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire