Skip to content
Advertisement

Microsoft Access 2016 SQL Unnest Array

I am trying to take a table and in Microsoft 2016 Access and use SQL to unnest a single column into multiple rows instead. It is comma separated.

I tried adding Unnest and keep getting errors, maybe I am missing something.

This BOGO_Sale.promo_parent_skus is the only column I am trying to unnest into rows.

An example of the table is:

example table of data

Here is an example of what I want my SQL query to turn the data into:

example of what I want the output of my SQL query to be

The data from my source system comes this way (long story) so I just need to convert it so I can do other analysis and work on it.

The version of Microsoft Access I am using is Office 365 ProPlus Access 2016 32-bit.

Advertisement

Answer

unnest does not exist in MS Access SQL.

To accomplish this in MS Access, you’ll likely need to use the VBA split function to convert the content of your promo_parent_skus field into an array, and build an output table containing the results.

Something like:

The above will generate a new table called BOGO_Output.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement