Mysql中什么解决函数Postgresql regexp_split_to_table

时间:2019-01-28 13:14:50

标签: mysql sql postgresql function

在PostgreSQL中具有功能

Select id, regexp_split_to_table(meta_value) from metas;

日期:

1, '45,46,47'
2, '10'
3, ''
4, '12,4558,456'

需要相同的结果

1, '45'
1, '45'
1, '47'
2, '10'
3, ''
4, '12'
4, '4558'
4, '456'

Mysql有什么解决方案?

是链接One Column,但导致一列,需要两列或更多列

1 个答案:

答案 0 :(得分:0)

尝试使用substring_index函数

$('document').ready(function() {
  $('#id_rental_table .add_new_form').on('click', function(e) {
    e.preventDefault();
    cloneForm();
    return false;
  });

  // this not working
  $('#id_rental_table .remove_new_form').on('click', function(e) {
    e.preventDefault();
    // console.log('remove called');
    $(this).parent().parent().remove();
    return false;
  });
}

function cloneForm() {
  var row = $('#id_rental_table tr:last');
  var newRow = row.clone(true);
  row.after(newRow);
  var btn = row.find('button.add_new_form');
  btn.html('-');
  btn.removeClass('add_new_form').addClass('remove_new_form');

  // even this won't wok.
  btn.on('click', function(e) {
    e.preventDefault();
    //console.log($(this));
    $(this).parent().parent().remove();
    return false;
  });

  newRow.find('button.add_new_form').html('+');
  newRow.find('select[name*=room_no]').val('').trigger('change');
}