combine two columns show range in third column (concat?)

Discussion in 'MySQL' started by xbat, Feb 10, 2015.

  1. #1
    Example of what I have

    col1 col2 col3
    246 247
    257 283
    01 04

    what I would like to do


    col1 col2 col3
    246 247 246,247
    257 260 257,258,259,260
    01 04 01,02,03,04


    what I have tried

    SELECT master,start,end,
    end-start as number,
    concat(start+1,',') as numbercombine
    FROM build LIMIT 20;




    SELECT master,start,end,
    if( between start and end,floor(1 + rand() * end)) as number
    FROM buildLIMIT 20;
     
    xbat, Feb 10, 2015 IP
  2. xbat

    xbat Well-Known Member

    Messages:
    326
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    105
    #2
    I found a way to do it with (php mysql) but not with just mysql :(
     
    Last edited: Feb 18, 2015
    xbat, Feb 18, 2015 IP