locked
substring mysql RRS feed

  • Question

  • User-646447061 posted

    hello, can you help me ..
    i want use function group by with substring  in mysql 

    i have field date type number like this 201608XX YYYYMMDD

    and i want group by only year and month (201608) without day
    please help me =)

    Sunday, August 21, 2016 9:26 AM

Answers

  • User2103319870 posted

    i want group by only year and month (201608) without day

    You can make use the substring function available mysql to extract the year and month.

    Sample Code

    SELECT SUBSTRING('20160811',1,6); 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 22, 2016 2:59 AM