i have table trying counts hour of day distinct column
| name | hr | # | +---+---+-----+----+ | | 00 | 10 | | | 01 | 11 | | b | 00 | 8 | | b | 01 | 9 | | c | 00 | 6 | | c | 01 | 7 | +-----+---+--+--+---+ 00 10 8 6 01 11 9 7
i need group hr list counts letters per hour. tried creating procedure loop through no luck.
perhaps group_concat()
suffice?
select hr, group_concat(`#`) my_table group hr
see on sqlfiddle.
you can split (string) result on delimiter, comma default can changed desired character (such u+001e, ascii "record separator") using separator
keyword.
Comments
Post a Comment