Search code examples
mariadbdynamic-columns

How to get child data from a dynamic column?


I have a dynamic column with the next structure:

blob_fields:
  name1: value1,
  name2: value2,
  name3:
    sub-name1: sub-value1,
    sub-name2: sub-value2

With COLUMN_GET(), how can I get those children's values of 'name3'?

I have tried using COLUMN_GET(blob_fields, COLUMN_GET(name3, sub-name1 as char)) as value, but it didn't worked for me.

Thanks so much


Solution

  • You should use the following statement for your particular case:

    SELECT column_get(column_get(blob_fields, 'name3' as char), 'sub-name1' as char) as FOO1
    FROM TBL_FOO
    

    You were almost right.