2

In Access 2013 I'm trying to split fields in a column into new rows but having no success with several routes I've tried. For example, Row 1 has ID # 1 with 3 codes pertaining to it separated by commas (12, 13, 14). I have been trying to run a query to separate row 1 into three rows, each having one of the codes but the same ID #.

My goal is to have the comment column split into separate records/rows with the correct corresponding ID #, etc.

I've tried several variations of the following SQL query in access with no success:

Select [1 Tracking].ID #, [1 Tracking]Codes
FROM [1 Tracking]
CROSS APPLY STRING_SPLIT([1 Tracking].Codes, ",");

Original Data on table

ID #   /   Code:
1          (12, 13, 14)
2          (13, 15)
3          (17)

(Only 3 rows) Results after running query;

ID #   /   Code:
1          (12)
1          (13)
1          (14)
2          (13)
2          (15)
3          (17)

(Now 6 rows instead of 3)

Any help would be greatly appreciated. I've only found VBA answers and have no idea how to use it. Thank you.

Parfait
  • 104,375
  • 17
  • 94
  • 125

0 Answers0