我需要MySQL表来逐月获得PHP结果组与单独的表?

时间:2017-12-17 02:58:11

标签: javascript php html mysql

  • | id | name | month | =================== | 1 |约翰|一月| | 2 | geo | June | | 3 | roy | 6月| | 4 | bon |六月| | 5 | ron | January | | 6 | jeny | 3月
    | | 7 | bily | March | | 8 | frnk | May | | 9 |乔|六月|

    我需要以月结表的形式出现并在同一个月打印一个 表

    1月| id | name | month | =================== | 1 |约翰|一月| | 5 | ron | January |

    ============================

    三月

    | id | name | month | =================== | 6 | jeny |三月| | 7 | bily | March |

    ============================

    | id | name | month | ===================== | 8 | frnk | May | ============================六月

    | id | name | month | ======================== | 2 | geo | June | | 3 | roy | 6月| | 4 | bon |六月|

    ===========================

1 个答案:

答案 0 :(得分:1)

您无法在单个查询中获取多个结果。 如果您需要单个月的结果,请使用

SELECT * FROM TABLE WHERE month='january'

如果您需要在一个表中使用所有月份组,请使用

SELECT * FROM TABLE GROUP BY month