Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 22484

Picking just a single value from Map of Arrays in SQL

$
0
0

This is SQL query.

Let's assume that you have column having the data type map of arrays

    profiles     map(int, array(int))

so in the table, you see

    profiles         {1: [1, 2]}    {2: [3, 4]}    {3: [10]}    {4: []}

Let's assume that you just wanna pick the first value from each (none if empty), so in the above case

    profiles         {1: 1}    {2: 3}    {3: 10}    {4: NULL}

and the new data type would be

   profiles  map(int, int)

is there a way to do this?


Viewing all articles
Browse latest Browse all 22484

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>