Skip to main content
deleted 365 characters in body
Source Link
deleted 32 characters in body
Source Link
user1822
user1822

I want to get a new columns on table and this new columns need to contain another columns name separate by "-"- example:  (field_1-field_2) where the values = X

I can not hardcorehard code the columnscolumn names because each times this columnstime these column name are different depends ofdepending on the projects.

|..id..|..field_1.|.field_2..|.field_3.|..field_4.|..field_5.| new_column..............|

|..1.. |.....X .....|..NULL..|.....X .....|..NULL..|.....X .....|field_1-field_3-field_5 |

|..2.. |..NULL..|.....X .....|.....X .....|..NULL..|..NULL..|field_2-field_3............         |

|..3.. |..NULL..|..NULL..|..NULL..|.....X .....|..NULL..| field_4........................|
|  id  |  field_1 | field_2  | field_3 |  field_4 |  field_5  | new_column              |
|  1   |     X    |  NULL    |      X  |  NULL    |     X     | field_1-field_3-field_5 |
|  2   |  NULL    |     X    |      X  |  NULL    |  NULL     | field_2-field_3         |
|  3   |  NULL    |  NULL    |   NULL  |     X    |  NULL     | field_4                 |

I want to get a new columns on table and this new columns need to contain another columns name separate by "-" example:(field_1-field_2) where the values = X

I can not hardcore the columns names because each times this columns name are different depends of the projects.

|..id..|..field_1.|.field_2..|.field_3.|..field_4.|..field_5.| new_column..............|

|..1.. |.....X .....|..NULL..|.....X .....|..NULL..|.....X .....|field_1-field_3-field_5 |

|..2.. |..NULL..|.....X .....|.....X .....|..NULL..|..NULL..|field_2-field_3............         |

|..3.. |..NULL..|..NULL..|..NULL..|.....X .....|..NULL..| field_4........................|

I want to get a new columns on table and this new columns need to contain another columns name separate by - example:  (field_1-field_2) where the values = X

I can not hard code the column names because each time these column name are different depending on the projects.

|  id  |  field_1 | field_2  | field_3 |  field_4 |  field_5  | new_column              |
|  1   |     X    |  NULL    |      X  |  NULL    |     X     | field_1-field_3-field_5 |
|  2   |  NULL    |     X    |      X  |  NULL    |  NULL     | field_2-field_3         |
|  3   |  NULL    |  NULL    |   NULL  |     X    |  NULL     | field_4                 |
added 28 characters in body
Source Link
McNets
  • 23.9k
  • 11
  • 50
  • 89

I want to get a new columns on table and this new columns need to contain another columns name separate by "-" example:(field_1-field_2) where the values = X

I can not hardcore the columns names because each times this columns name are different depends of the projects.

|..id..|..field_1.|.field_2..|.field_3.|..field_4.|..field_5.| new_column..............|

|..1.. |.....X .....|..NULL..|.....X .....|..NULL..|.....X .....|field_1-field_3-field_5 |

|..2.. |..NULL..|.....X .....|.....X .....|..NULL..|..NULL..|field_2-field_3............ |

|..3.. |..NULL..|..NULL..|..NULL..|.....X .....|..NULL..| field_4........................|

|..id..|..field_1.|.field_2..|.field_3.|..field_4.|..field_5.| new_column..............|

|..1.. |.....X .....|..NULL..|.....X .....|..NULL..|.....X .....|field_1-field_3-field_5 |

|..2.. |..NULL..|.....X .....|.....X .....|..NULL..|..NULL..|field_2-field_3............         |

|..3.. |..NULL..|..NULL..|..NULL..|.....X .....|..NULL..| field_4........................|

I want to get a new columns on table and this new columns need to contain another columns name separate by "-" example:(field_1-field_2) where the values = X

I can not hardcore the columns names because each times this columns name are different depends of the projects.

|..id..|..field_1.|.field_2..|.field_3.|..field_4.|..field_5.| new_column..............|

|..1.. |.....X .....|..NULL..|.....X .....|..NULL..|.....X .....|field_1-field_3-field_5 |

|..2.. |..NULL..|.....X .....|.....X .....|..NULL..|..NULL..|field_2-field_3............ |

|..3.. |..NULL..|..NULL..|..NULL..|.....X .....|..NULL..| field_4........................|

I want to get a new columns on table and this new columns need to contain another columns name separate by "-" example:(field_1-field_2) where the values = X

I can not hardcore the columns names because each times this columns name are different depends of the projects.

|..id..|..field_1.|.field_2..|.field_3.|..field_4.|..field_5.| new_column..............|

|..1.. |.....X .....|..NULL..|.....X .....|..NULL..|.....X .....|field_1-field_3-field_5 |

|..2.. |..NULL..|.....X .....|.....X .....|..NULL..|..NULL..|field_2-field_3............         |

|..3.. |..NULL..|..NULL..|..NULL..|.....X .....|..NULL..| field_4........................|
deleted 365 characters in body
Source Link
Loading
added 44 characters in body
Source Link
Randi Vertongen
  • 16.5k
  • 4
  • 35
  • 64
Loading
Source Link
Loading