1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

splitting apart a mysql column with mutliple values. Not sure how to display

Discussion in 'Databases' started by xbat, Nov 27, 2017.

  1. daoustma

    daoustma Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #21
    If you want something "dirty" that may do the job (temporarily), try something like this. It isn't pretty and only works for a set number of substrings values.

    
    SELECT
      tp.id,
      tp.selected_y,
      tp.selected_m,
      SUBSTRING_INDEX(tp.all, 'add to bob', 2) AS value
      FROM tp
    UNION
    SELECT
      tp.id,
      tp.selected_y,
      tp.selected_m,
      SUBSTRING_INDEX(SUBSTRING_INDEX(tp.all, 'add to bob', 3), 'add to bob', -1) AS value
      FROM tp
    UNION
    SELECT
      tp.id,
      tp.selected_y,
      tp.selected_m,
      SUBSTRING_INDEX(SUBSTRING_INDEX(tp.all, 'add to bob', 4), 'add to bob', -1) AS value
      FROM tp
    
    Code (markup):

    SEMrush
     
    Last edited: Dec 16, 2017
    daoustma, Dec 16, 2017 IP
    SEMrush
  2. xbat

    xbat Active Member

    Messages:
    312
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    55
    #22
    thank you.
     
    xbat, Dec 16, 2017 IP