mysql - My SQL Convert Rows to Column Dynamicaly -


how can type of result.

table |id | companyname| ----+------------- |1  |companya    | |2  |companyb    | |3  |companyc    | 

and table b have primary id of table a

table b |id | studentname|companyid |submitdate ----+------------+----------+---------- |1  |abc         |1         |2017-01-02 |2  |abc         |2         |2017-01-03 |3  |abc         |1         |2017-01-02 |4  |abc         |3         |2017-01-03 |5  |abc         |1         |2017-01-03 |6  |abc         |1         |2017-01-01 |7  |abc         |2         |2017-01-02 |8  |abc         |2         |2017-01-03 |9  |abc         |3         |2017-01-02    

how count number of entry particular company each date.

here result table want.

|submitdate | companya |companyb |companyc ------------+----------+---------- |2017-01-01 |1         |0        |0 |2017-01-02 |2         |1        |1 |2017-01-03 |1         |2        |1 


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -